Zireael пишет:
Костыль, но в общем работает.
Подсказка в edit
Подсказка в edit
Без таймера (Отобразить)
CODE:
#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
external(INT, "GetDC", "GetDC", "User32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll" );
external(INT, "GetFocus", "GetFocus", "User32.dll" );
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll" );
int edit1, edit2, hdc1, hdc2, font1;
char c1[99], c2[99], temp[99];
strcpy(#c1[0], "Логин");
strcpy(#c2[0], "Пароль");
createdialog(0);
showdialog(0, "Диалог", 100, 100, 300, 200, 1, 1);
loop()sleep(1);
function getmessage(0, WM_CREATE)
{
edit1=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 10, 100, 21, gethwnd(0), 0, 0, 0);
edit2=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 40, 100, 21, gethwnd(0), 0, 0, 0);
font1=CreateFont(18, 0, 0, 0, 300, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
hdc1=GetDC(edit1);
hdc2=GetDC(edit2);
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam == edit1){update(formatiw(edit1)); return; }
if(message.lparam == edit2){update(formatiw(edit2)); return; }
}
function getmessage(0, WM_CTLCOLOREDIT)
{
if(GetFocus() != edit1)
{
if(GetWindowText(edit1, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc1, font1);
SetBkMode(hdc1, 0);
SetTextColor(hdc1, rgb(200, 200, 200)); // цвет подсказки
TextOut(hdc1, 5, 1, address(#c1[0]), size(format(#c1[0])));
}
}
if(GetFocus() != edit2)
{
if(GetWindowText(edit2, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc2, font1);
SetBkMode(hdc2, 0);
SetTextColor(hdc2, rgb(200, 200, 200));
TextOut(hdc2, 5, 1, address(#c2[0]), size(format(#c2[0])));
}
}
}
#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
external(INT, "GetDC", "GetDC", "User32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll" );
external(INT, "GetFocus", "GetFocus", "User32.dll" );
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll" );
int edit1, edit2, hdc1, hdc2, font1;
char c1[99], c2[99], temp[99];
strcpy(#c1[0], "Логин");
strcpy(#c2[0], "Пароль");
createdialog(0);
showdialog(0, "Диалог", 100, 100, 300, 200, 1, 1);
loop()sleep(1);
function getmessage(0, WM_CREATE)
{
edit1=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 10, 100, 21, gethwnd(0), 0, 0, 0);
edit2=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 40, 100, 21, gethwnd(0), 0, 0, 0);
font1=CreateFont(18, 0, 0, 0, 300, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
hdc1=GetDC(edit1);
hdc2=GetDC(edit2);
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam == edit1){update(formatiw(edit1)); return; }
if(message.lparam == edit2){update(formatiw(edit2)); return; }
}
function getmessage(0, WM_CTLCOLOREDIT)
{
if(GetFocus() != edit1)
{
if(GetWindowText(edit1, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc1, font1);
SetBkMode(hdc1, 0);
SetTextColor(hdc1, rgb(200, 200, 200)); // цвет подсказки
TextOut(hdc1, 5, 1, address(#c1[0]), size(format(#c1[0])));
}
}
if(GetFocus() != edit2)
{
if(GetWindowText(edit2, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc2, font1);
SetBkMode(hdc2, 0);
SetTextColor(hdc2, rgb(200, 200, 200));
TextOut(hdc2, 5, 1, address(#c2[0]), size(format(#c2[0])));
}
}
}
Красный фон текста, синий текст (Отобразить)
CODE:
#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
external(INT, "GetDC", "GetDC", "User32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetBkColor", "SetBkColor", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "GetFocus", "GetFocus", "User32.dll" );
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll" );
external(INT, "InvalidateRect", "InvalidateRect", "User32.dll" );
int edit1, edit2, hdc1, hdc2, font1;
char c1[99], c2[99], temp[99];
strcpy(#c1[0], "Логин");
strcpy(#c2[0], "Пароль");
int t1=0, t2=0;
createdialog(0);
showdialog(0, "Диалог", 100, 100, 300, 200, 1, 1);
loop()sleep(1);
function getmessage(0, WM_CREATE)
{
edit1=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 10, 100, 21, gethwnd(0), 0, 0, 0);
edit2=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 40, 100, 21, gethwnd(0), 0, 0, 0);
font1=CreateFont(18, 0, 0, 0, 300, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
hdc1=GetDC(edit1);
hdc2=GetDC(edit2);
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam == edit1){update(formatiw(edit1)); return; }
if(message.lparam == edit2){update(formatiw(edit2)); return; }
}
function getmessage(0, WM_CTLCOLOREDIT)
{
if(GetFocus() != edit1)
{
if(GetWindowText(edit1, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc1, font1);
//Красный фон текста синий текст
SetBkColor(hdc1, rgb(255, 0, 0));
SetTextColor(hdc1, rgb(0, 255, 0)); // цвет подсказки
TextOut(hdc1, 5, 1, address(#c1[0]), size(format(#c1[0])));
t1=1;
}
}
else {if (t1==1){t1=0; InvalidateRect(edit1, 0, 1);}}
if(GetFocus() != edit2)
{
if(GetWindowText(edit2, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc2, font1);
//Красный фон текста синий текст
SetBkColor(hdc2, rgb(255, 0, 0));
SetTextColor(hdc2, rgb(0, 255, 0)); // цвет подсказки
TextOut(hdc2, 5, 1, address(#c2[0]), size(format(#c2[0])));
t2=1;
}
}
else {if (t2==1){t2=0; InvalidateRect(edit2, 0, 1);}}
}
#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
external(INT, "GetDC", "GetDC", "User32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetBkColor", "SetBkColor", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "GetFocus", "GetFocus", "User32.dll" );
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll" );
external(INT, "InvalidateRect", "InvalidateRect", "User32.dll" );
int edit1, edit2, hdc1, hdc2, font1;
char c1[99], c2[99], temp[99];
strcpy(#c1[0], "Логин");
strcpy(#c2[0], "Пароль");
int t1=0, t2=0;
createdialog(0);
showdialog(0, "Диалог", 100, 100, 300, 200, 1, 1);
loop()sleep(1);
function getmessage(0, WM_CREATE)
{
edit1=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 10, 100, 21, gethwnd(0), 0, 0, 0);
edit2=CreateWindow(0, "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 40, 100, 21, gethwnd(0), 0, 0, 0);
font1=CreateFont(18, 0, 0, 0, 300, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
hdc1=GetDC(edit1);
hdc2=GetDC(edit2);
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam == edit1){update(formatiw(edit1)); return; }
if(message.lparam == edit2){update(formatiw(edit2)); return; }
}
function getmessage(0, WM_CTLCOLOREDIT)
{
if(GetFocus() != edit1)
{
if(GetWindowText(edit1, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc1, font1);
//Красный фон текста синий текст
SetBkColor(hdc1, rgb(255, 0, 0));
SetTextColor(hdc1, rgb(0, 255, 0)); // цвет подсказки
TextOut(hdc1, 5, 1, address(#c1[0]), size(format(#c1[0])));
t1=1;
}
}
else {if (t1==1){t1=0; InvalidateRect(edit1, 0, 1);}}
if(GetFocus() != edit2)
{
if(GetWindowText(edit2, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc2, font1);
//Красный фон текста синий текст
SetBkColor(hdc2, rgb(255, 0, 0));
SetTextColor(hdc2, rgb(0, 255, 0)); // цвет подсказки
TextOut(hdc2, 5, 1, address(#c2[0]), size(format(#c2[0])));
t2=1;
}
}
else {if (t2==1){t2=0; InvalidateRect(edit2, 0, 1);}}
}