CODE:#define WS_CHILD 1073741824
#define WS_VISIBLE 268435456
#define LBS_OWNERDRAWVARIABLE 32
#define LB_ADDSTRING 384
#define LB_GETCURSEL 392
#define LB_SETCURSEL 390
#define PS_SOLID 0
#define TRANSPARENT 1
#define LBS_NOTIFY 1
#define SRCCOPY 13369376
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "ReleaseDC", "ReleaseDC", "User32.dll");
external(INT, "DeleteDC", "DeleteDC", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "TextOut", "TextOutA", "Gdi32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "GetTextExtentPoint32", "GetTextExtentPoint32A", "Gdi32.dll");
int list;
int HDC_list, Comp, bitmap;
int brush, pen, brush_frame;
int rect[4]={10, 10, 100, 150} // координаты списка
string text_list[5]={"Строка1", "Строка2", "Текст", "111", "22222"} // текст строк
int text_color[5]={255, 5810467, 0, 16000000, 15960251} // цвет строк
int text_w_h[2];
createdialog(0);
showdialog(0, "Диалог",100, 100, 300, 300, 4, 1);
loop()
{
textout(0, 0, 0, "Выбранная строка: "+format(sendmessage(LB_GETCURSEL, 0, 0, formatiw(list))), 1);
sleep(10);
}
function getmessage(0, WM_CREATE)
{
list=CreateWindow(0, "LISTBOX", "", LBS_OWNERDRAWVARIABLE | LBS_NOTIFY | WS_CHILD | WS_VISIBLE, rect[0], rect[1], rect[2], rect[3], gethwnd(0), 0, 0, 0);
HDC_list=GetDC(list);
Comp = CreateCompatibleDC(HDC_list);
bitmap =CreateCompatibleBitmap(HDC_list, rect[2], rect[3]);
SelectObject(Comp, bitmap);
brush=CreateSolidBrush(16769968); // цвет фона
pen=CreatePen(PS_SOLID, 1, 16000000); // толщина и цвет рамки
brush_frame=CreateSolidBrush(127482); // цвет выделенной строки списка
SetBkMode(Comp, TRANSPARENT);
char c[99];
for(int i=0; i<sizearray(text_list); i++)
{
strcpy(#c[0], text_list[i]);
sendmessage(LB_ADDSTRING, 0, address(#c[0]), formatiw(list));
}
GetTextExtentPoint32(Comp, address(#c[0]), size(#c[0]), address(#text_w_h[0]));
sendmessage(LB_SETCURSEL, 2, 0, formatiw(list));
}
function getmessage(0, WM_DRAWITEM)
{
SelectObject(Comp, brush);
SelectObject(Comp, pen);
Rectangle(Comp, 0, 0, rect[2], rect[3]);
int cur_item=sendmessage(LB_GETCURSEL, 0, 0, formatiw(list));
if(cur_item != -1)
{
SelectObject(Comp, brush_frame);
Rectangle(Comp, 0, cur_item * text_w_h[1], 100, text_w_h[1] + cur_item * text_w_h[1]);
}
for(int i=0; i<sizearray(text_list); i++)
{
SetTextColor(Comp, text_color[i]);
TextOut(Comp, 5, text_w_h[1] * i, text_list[i], size(text_list[i]));
}
BitBlt(HDC_list, 0, 0, rect[2], rect[3], Comp, 0, 0, SRCCOPY);
}
function getmessage (0, WM_CLOSE)
{
ReleaseDC(gethwnd(0), HDC_list);
DeleteDC(Comp);
DeleteObject(bitmap);
DeleteObject(brush);
DeleteObject(pen);
DeleteObject(brush_frame);
destroydialog(0);
// close(); // закрыть кибор
loop() // цикл можно убрать
{
textbkcolor(255, 0);
textout(99, 300, 300, "Остановить скрипт Ctrl + Shift + Z", 1);
sleep(200);
textbkcolor(0, 255);
textout(99, 300, 300, "Остановить скрипт Ctrl + Shift + Z", 1);
sleep(200);
}
}