007wan |
Отправлено: 11 Ноября, 2019 - 12:40:01
|
Эксперт
Покинул форум
Сообщений всего: 1838
Дата рег-ции: Март 2017
Репутация: -2
|
Zireael , Да я уже сделал давно.
Код (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define PS_SOLID 0
#define PS_NULL 5
#define SRCCOPY 13369376
#define TRANSPARENT 1
#define DT_CENTER 1
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "RoundRect", "RoundRect", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "PtInRect", "PtInRect", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "DrawText", "DrawTextA", "User32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "Ellipse", "Ellipse", "Gdi32.dll");
#definefile "C:\Users\Home\Desktop\kibor_set\Constants.txt";
int h_font, old_font;
int mouseX, mouse_Y;
int hdc, hdc_mem, hdc_bitmap;
int pen, brush1, brush2, brush_fon, old_pen, old_brush;
pen = CreatePen(PS_NULL, 0, 0);
brush_fon = CreateSolidBrush(14013909);
brush1 = CreateSolidBrush(4307199);
brush2 = CreateSolidBrush(3309517);
int current_tab = 0;
int rect_tab[3][4];
rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
//rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=235; rect_tab[1][3]=40;
//rect_tab[2][0]=240; rect_tab[2][1]=15; rect_tab[2][2]=255; rect_tab[2][3]=30;//240 10 320 40
string text_tab[3] = {"Ïóñòàÿ âêëàäêà", "1", "+"};
string Control_text_buttons[2] = {"+", "-"};
int cord_control_buttons[2][4];
cord_control_buttons[0][0] = 171; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 150; cord_control_buttons[0][3] = 31;//+
//cord_control_buttons[1][0] = 10; cord_control_buttons[1][1] = 10; cord_control_buttons[1][2] = 10; cord_control_buttons[1][3] = 10;//-
int image_width = 600;
int image_height = 500;
createdialog(0);
showdialog(0, "BALLOON BOT", 200, 200, 515, 500, 1, 1);
enabletimer(0);
//-----------------------------------------------------------------------------------------------------------------------------------------------------
loop()
{
sleep(10);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_CREATE)
{
hdc = GetDC(gethwnd(0));
hdc_mem = CreateCompatibleDC(hdc);
hdc_bitmap = CreateCompatibleBitmap(hdc, image_width, image_height);
SelectObject(hdc_mem, hdc_bitmap);
SetBkMode(hdc_mem, TRANSPARENT);
h_font = CreateFont(-14, 0, 0, 0, 500, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Comic Sans MS");
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_MOVE)
{
pause(100);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE_TIMER(0, 30)
{
if(getkeystate(1))
{
while(getkeystate(1))
{
sleep(10);
}
for(int tab_=0; tab_<sizearray(rect_tab); tab_++)
{
getmouse(mouseX, mouse_Y, formatiw(gethwnd(0)));
if(PtInRect(address(#rect_tab[tab_][0]), mouseX, mouse_Y))
{
current_tab=tab_;
break;
}
//======
if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
messagebox(1);
break;
}
}
}
paint();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function paint()
{
old_pen = SelectObject(hdc_mem, pen);
old_brush = SelectObject(hdc_mem, brush_fon);
Rectangle(hdc_mem, 0, 0, image_width+1, image_height+1);
SelectObject(hdc_mem, old_brush);
for(int i=0; i<sizearray(rect_tab); i++)
{
if(i == current_tab)
{
old_brush = SelectObject(hdc_mem, brush1);
}
else
{
old_brush = SelectObject(hdc_mem, brush2);
}
RoundRect(hdc_mem, rect_tab[i][0], rect_tab[i][1], rect_tab[i][2], rect_tab[i][3], 10, 10);
SelectObject(hdc_mem, old_brush);
SetTextColor(hdc_mem, 0);
old_font = SelectObject(hdc_mem, h_font);
DrawText(hdc_mem, text_tab[i], size(text_tab[i]), address(#rect_tab[i][0]), DT_CENTER);
//SelectObject(hdc_mem, old_font);
}
old_brush = SelectObject(hdc_mem, brush1);
RoundRect(hdc_mem, 10, 30, 500, 250, 10, 10);
RoundRect(hdc_mem, 171, 10, 150, 31, 10, 10);
//Ellipse(hdc_mem, 41, 10, 20, 31);
//Ellipse(hdc_mem, 171, 10, 150, 31);
DrawText(hdc_mem, Control_text_buttons[0], size(Control_text_buttons[0]), address(#cord_control_buttons[0][0]), DT_CENTER);//Äîáâàèòü + âîçëå âêëàäêè
SelectObject(hdc_mem, old_brush);
SelectObject(hdc_mem, old_pen);
BitBlt(hdc, 0, 0, image_width, image_height, hdc_mem, 0, 0, SRCCOPY);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
И что теперь? Как отловить нажатия? CODE:if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
messagebox(1);
break;
} Не работает
(Добавление)
Zireael пишет: Так сложно указать прямоугольник, в котором должен быть написан текст?
CODE:cord_control_buttons[0][0] = 160; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 180; cord_control_buttons[0][3] = 30;//+ После рабочего месяца , все мозги в кучу не могу собрать, даже элементарно код простецкий написать)) |
|
|
007wan |
Отправлено: 11 Ноября, 2019 - 12:49:58
|
Эксперт
Покинул форум
Сообщений всего: 1838
Дата рег-ции: Март 2017
Репутация: -2
|
Zireael пишет: Цитата: cord_control_buttons[0][0] = 171; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 150;
Начальная координата X больше конечной. Всё зарабтало, спасибки)
(Добавление)
Опять аномалии)))
Код (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define PS_SOLID 0
#define PS_NULL 5
#define SRCCOPY 13369376
#define TRANSPARENT 1
#define DT_CENTER 1
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "RoundRect", "RoundRect", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "PtInRect", "PtInRect", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "DrawText", "DrawTextA", "User32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "Ellipse", "Ellipse", "Gdi32.dll");
#definefile "C:\Users\Home\Desktop\kibor_set\Constants.txt";
int h_font, old_font;
int mouseX, mouse_Y;
int hdc, hdc_mem, hdc_bitmap;
int pen, brush1, brush2, brush_fon, old_pen, old_brush;
pen = CreatePen(PS_NULL, 0, 0);
brush_fon = CreateSolidBrush(14013909);
brush1 = CreateSolidBrush(4307199);
brush2 = CreateSolidBrush(3309517);
int current_tab = 0;
int rect_tab[3][4];
rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
//rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=235; rect_tab[1][3]=40;
//rect_tab[2][0]=240; rect_tab[2][1]=15; rect_tab[2][2]=255; rect_tab[2][3]=30;//240 10 320 40
string text_tab[3] = {"Пустая вкладка", "1", "+"};
string Control_text_buttons[2] = {"+", "-"};
int cord_control_buttons[2][4];
cord_control_buttons[0][0] = 142; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 180; cord_control_buttons[0][3] = 30;//+ 1 вкладка
//cord_control_buttons[1][0] = 10; cord_control_buttons[1][1] = 10; cord_control_buttons[1][2] = 10; cord_control_buttons[1][3] = 10;//-
int image_width = 600;
int image_height = 500;
createdialog(0);
showdialog(0, "BALLOON BOT", 200, 200, 515, 500, 1, 1);
enabletimer(0);
//-----------------------------------------------------------------------------------------------------------------------------------------------------
loop()
{
sleep(10);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_CREATE)
{
hdc = GetDC(gethwnd(0));
hdc_mem = CreateCompatibleDC(hdc);
hdc_bitmap = CreateCompatibleBitmap(hdc, image_width, image_height);
SelectObject(hdc_mem, hdc_bitmap);
SetBkMode(hdc_mem, TRANSPARENT);
h_font = CreateFont(-14, 0, 0, 0, 500, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Comic Sans MS");
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_MOVE)
{
pause(100);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE_TIMER(0, 30)
{
if(getkeystate(1))
{
while(getkeystate(1))
{
sleep(10);
}
for(int tab_=0; tab_<sizearray(rect_tab); tab_++)
{
getmouse(mouseX, mouse_Y, formatiw(gethwnd(0)));
if(PtInRect(address(#rect_tab[tab_][0]), mouseX, mouse_Y))
{
current_tab=tab_;
break;
}
//======
if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
messagebox(1);
break;
}
}
}
paint();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function paint()
{
old_pen = SelectObject(hdc_mem, pen);
old_brush = SelectObject(hdc_mem, brush_fon);
Rectangle(hdc_mem, 0, 0, image_width+1, image_height+1);
SelectObject(hdc_mem, old_brush);
for(int i=0; i<sizearray(rect_tab); i++)
{
if(i == current_tab)
{
old_brush = SelectObject(hdc_mem, brush1);
}
else
{
old_brush = SelectObject(hdc_mem, brush2);
}
RoundRect(hdc_mem, rect_tab[i][0], rect_tab[i][1], rect_tab[i][2], rect_tab[i][3], 10, 10);
SelectObject(hdc_mem, old_brush);
SetTextColor(hdc_mem, 0);
old_font = SelectObject(hdc_mem, h_font);
DrawText(hdc_mem, text_tab[i], size(text_tab[i]), address(#rect_tab[i][0]), DT_CENTER);
//SelectObject(hdc_mem, old_font);
}
old_brush = SelectObject(hdc_mem, brush1);
RoundRect(hdc_mem, 10, 30, 500, 250, 10, 10);
RoundRect(hdc_mem, 171, 10, 150, 31, 10, 10);
//Ellipse(hdc_mem, 41, 10, 20, 31);
//Ellipse(hdc_mem, 171, 10, 150, 31);
DrawText(hdc_mem, Control_text_buttons[0], size(Control_text_buttons[0]), address(#cord_control_buttons[0][0]), DT_CENTER);//Добваить + возле вкладки
SelectObject(hdc_mem, old_brush);
SelectObject(hdc_mem, old_pen);
BitBlt(hdc, 0, 0, image_width, image_height, hdc_mem, 0, 0, SRCCOPY);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
1)Ошибка, когда жмем возле прямоугольника "+" и прилетает сообщение.
2)Нельзя ли как-то объединить координаты прямоугольника "+" и текст "+"?
(Добавление)
Я в этих цифрах запутался( не могу разобраться что к чему в данном случаи и как писать зависимость. |
|
|
Zireael |
Отправлено: 11 Ноября, 2019 - 13:05:07
|
Эксперт
Покинул форум
Сообщений всего: 4456
Дата рег-ции: Нояб. 2017
Репутация: 585
|
Цитата: 2)Нельзя ли как-то объединить координаты прямоугольника "+" и текст "+"?
Можно, и даже нужно.
Цитата: RoundRect(hdc_mem, 171, 10, 150, 31, 10, 10);
CODE:RoundRect(hdc_mem, cord_control_buttons[0][0], cord_control_buttons[0][1], cord_control_buttons[0][2], cord_control_buttons[0][3], 10, 10);
Цитата: RoundRect(hdc_mem, 171, 10, 150, 31, 10, 10);
//Ellipse(hdc_mem, 41, 10, 20, 31);
//Ellipse(hdc_mem, 171, 10, 150, 31);
Столько лет пользоваться программой и не понимать элементарных вещей. Начальные координаты должны быть меньше конечных. |
|
|
007wan |
Отправлено: 11 Ноября, 2019 - 13:10:36
|
Эксперт
Покинул форум
Сообщений всего: 1838
Дата рег-ции: Март 2017
Репутация: -2
|
Zireael пишет: Столько лет пользоваться программой и не понимать элементарных вещей. Начальные координаты должны быть меньше конечных. Знаю, печально. Я это исправил, просто что ниже было - не нужно было. поэтому не исправлял.
(Добавление)
Всё, я догнал! Это как контрол-шифт-эс плучает координаты икс и игрек. икс- начальная, игрек - конечная, только тут ниже они чередуются!
CODE:RoundRect(hdc_mem, x1, x2, y1, y2, u, u);
(Добавление)
Zireael , ПОЛУЧИЛОСЬ!!!!! Спасибо огромное!!!!
КОД (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define PS_SOLID 0
#define PS_NULL 5
#define SRCCOPY 13369376
#define TRANSPARENT 1
#define DT_CENTER 1
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "RoundRect", "RoundRect", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "PtInRect", "PtInRect", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "DrawText", "DrawTextA", "User32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "Ellipse", "Ellipse", "Gdi32.dll");
#definefile "C:\Users\Home\Desktop\kibor_set\Constants.txt";
int h_font, old_font;
int mouseX, mouse_Y;
int hdc, hdc_mem, hdc_bitmap;
int pen, brush1, brush2, brush_fon, old_pen, old_brush;
pen = CreatePen(PS_NULL, 0, 0);
brush_fon = CreateSolidBrush(14013909);
brush1 = CreateSolidBrush(4307199);
brush2 = CreateSolidBrush(3309517);
int current_tab = 0;
int rect_tab[3][4];
//rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
//rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=235; rect_tab[1][3]=40;
//rect_tab[2][0]=240; rect_tab[2][1]=15; rect_tab[2][2]=255; rect_tab[2][3]=30;//240 10 320 40
string text_tab[3] = {"Пустая вкладка", "1", "+"};
string Control_text_buttons[2] = {"+", "-"};
int cord_control_buttons[2][4];
cord_control_buttons[0][0] = 25; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 47; cord_control_buttons[0][3] = 31;//+ нету вкладки
//cord_control_buttons[0][0] = 152; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 174; cord_control_buttons[0][3] = 31;//+ 1 вкладка
//cord_control_buttons[1][0] = 10; cord_control_buttons[1][1] = 10; cord_control_buttons[1][2] = 10; cord_control_buttons[1][3] = 10;//-
int image_width = 600;
int image_height = 500;
createdialog(0);
showdialog(0, "BALLOON BOT", 200, 200, 515, 500, 1, 1);
enabletimer(0);
//-----------------------------------------------------------------------------------------------------------------------------------------------------
loop()
{
sleep(10);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_CREATE)
{
hdc = GetDC(gethwnd(0));
hdc_mem = CreateCompatibleDC(hdc);
hdc_bitmap = CreateCompatibleBitmap(hdc, image_width, image_height);
SelectObject(hdc_mem, hdc_bitmap);
SetBkMode(hdc_mem, TRANSPARENT);
h_font = CreateFont(-14, 0, 0, 0, 500, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Comic Sans MS");
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_MOVE)
{
pause(100);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE_TIMER(0, 30)
{
if(getkeystate(1))
{
while(getkeystate(1))
{
sleep(10);
}
for(int tab_=0; tab_<sizearray(rect_tab); tab_++)
{
getmouse(mouseX, mouse_Y, formatiw(gethwnd(0)));
if(PtInRect(address(#rect_tab[tab_][0]), mouseX, mouse_Y))
{
current_tab=tab_;
break;
}
//======
if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
cord_control_buttons[0][0] = 152; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 174; cord_control_buttons[0][3] = 31;//+ 1 вкладка
break;
}
}
}
paint();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function paint()
{
old_pen = SelectObject(hdc_mem, pen);
old_brush = SelectObject(hdc_mem, brush_fon);
Rectangle(hdc_mem, 0, 0, image_width+1, image_height+1);
SelectObject(hdc_mem, old_brush);
for(int i=0; i<sizearray(rect_tab); i++)
{
if(i == current_tab)
{
old_brush = SelectObject(hdc_mem, brush1);
}
else
{
old_brush = SelectObject(hdc_mem, brush2);
}
RoundRect(hdc_mem, rect_tab[i][0], rect_tab[i][1], rect_tab[i][2], rect_tab[i][3], 10, 10);
SelectObject(hdc_mem, old_brush);
SetTextColor(hdc_mem, 0);
old_font = SelectObject(hdc_mem, h_font);
DrawText(hdc_mem, text_tab[i], size(text_tab[i]), address(#rect_tab[i][0]), DT_CENTER);
//SelectObject(hdc_mem, old_font);
}
old_brush = SelectObject(hdc_mem, brush1);
RoundRect(hdc_mem, 10, 30, 500, 250, 10, 10);
RoundRect(hdc_mem, cord_control_buttons[0][0], cord_control_buttons[0][1], cord_control_buttons[0][2], cord_control_buttons[0][3], 10, 10);
DrawText(hdc_mem, Control_text_buttons[0], size(Control_text_buttons[0]), address(#cord_control_buttons[0][0]), DT_CENTER);//Добваить + возле вкладки
SelectObject(hdc_mem, old_brush);
SelectObject(hdc_mem, old_pen);
BitBlt(hdc, 0, 0, image_width, image_height, hdc_mem, 0, 0, SRCCOPY);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
(Добавление)
Вопросик: Как теперь считать:
-какие вкладки УЖЕ созданы после запуска(что бы в будущем при запуске уже назначать какие созданы, какой текст у них, а значит и содержимое...)
-а как оттолкнуться, не могу вникнуть: вот мы создали одну вкладку, как теперь создать вторую? Ведь при нажатии на "+" он снова будет создавать только одну вкладку... |
|
|
007wan |
Отправлено: 11 Ноября, 2019 - 14:05:20
|
Эксперт
Покинул форум
Сообщений всего: 1838
Дата рег-ции: Март 2017
Репутация: -2
|
Что-то не вдупляю. (Код расчитан на создание первых двух вкладок). for где-то не правильно написан. Можно чуть подсказку, пжд
Код (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define PS_SOLID 0
#define PS_NULL 5
#define SRCCOPY 13369376
#define TRANSPARENT 1
#define DT_CENTER 1
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "RoundRect", "RoundRect", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "PtInRect", "PtInRect", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "DrawText", "DrawTextA", "User32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "Ellipse", "Ellipse", "Gdi32.dll");
#definefile "C:\Users\Home\Desktop\kibor_set\Constants.txt";
int h_font, old_font;
int mouseX, mouse_Y;
int hdc, hdc_mem, hdc_bitmap;
int pen, brush1, brush2, brush_fon, old_pen, old_brush;
pen = CreatePen(PS_NULL, 0, 0);
brush_fon = CreateSolidBrush(14013909);
brush1 = CreateSolidBrush(4307199);
brush2 = CreateSolidBrush(3309517);
int current_tab = 0;
int rect_tab[3][4];
int created_tab;
//rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
//rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=280; rect_tab[1][3]=40;
//rect_tab[2][0]=240; rect_tab[2][1]=15; rect_tab[2][2]=255; rect_tab[2][3]=30;//240 10 320 40
string text_tab[3] = {"Пустая вкладка1", "Новая вкладка2", "Новая вкладка3"};
string Control_text_buttons[2] = {"+", "-"};
int cord_control_buttons[2][4];
cord_control_buttons[0][0] = 25; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 47; cord_control_buttons[0][3] = 31;//+ нету вкладки
//cord_control_buttons[0][0] = 154; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 176; cord_control_buttons[0][3] = 31;//+ 1 вкладка
//cord_control_buttons[0][0] = 284; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 306; cord_control_buttons[0][3] = 31;//+ 2 вкладка
//cord_control_buttons[1][0] = 10; cord_control_buttons[1][1] = 10; cord_control_buttons[1][2] = 10; cord_control_buttons[1][3] = 10;//-
int image_width = 600;
int image_height = 500;
createdialog(0);
showdialog(0, "BALLOON BOT", 200, 200, 515, 500, 1, 1);
enabletimer(0);
//-----------------------------------------------------------------------------------------------------------------------------------------------------
loop()
{
sleep(10);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_CREATE)
{
hdc = GetDC(gethwnd(0));
hdc_mem = CreateCompatibleDC(hdc);
hdc_bitmap = CreateCompatibleBitmap(hdc, image_width, image_height);
SelectObject(hdc_mem, hdc_bitmap);
SetBkMode(hdc_mem, TRANSPARENT);
h_font = CreateFont(-14, 0, 0, 0, 500, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Comic Sans MS");
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_MOVE)
{
pause(100);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE_TIMER(0, 30)
{
if(getkeystate(1))
{
while(getkeystate(1))
{
sleep(10);
}
for(int tab_=0; tab_<sizearray(rect_tab); tab_++)
{
getmouse(mouseX, mouse_Y, formatiw(gethwnd(0)));
if(PtInRect(address(#rect_tab[tab_][0]), mouseX, mouse_Y))
{
current_tab=tab_;
break;
}
//======
if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
for (int a=0; a<sizearray(cord_control_buttons); a++)
{
rect_tab[a][0]=25; rect_tab[a][1]=10; rect_tab[a][2]=150; rect_tab[0][3]=40;
cord_control_buttons[a][0] = 154; cord_control_buttons[a][1] = 10; cord_control_buttons[a][2] = 176; cord_control_buttons[a][3] = 31;//+ 1 вкладка
}
break;
}
}
}
paint();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function paint()
{
old_pen = SelectObject(hdc_mem, pen);
old_brush = SelectObject(hdc_mem, brush_fon);
Rectangle(hdc_mem, 0, 0, image_width+1, image_height+1);
SelectObject(hdc_mem, old_brush);
for(int i=0; i<sizearray(rect_tab); i++)
{
if(i == current_tab)
{
old_brush = SelectObject(hdc_mem, brush1);
}
else
{
old_brush = SelectObject(hdc_mem, brush2);
}
RoundRect(hdc_mem, rect_tab[i][0], rect_tab[i][1], rect_tab[i][2], rect_tab[i][3], 10, 10);
SelectObject(hdc_mem, old_brush);
SetTextColor(hdc_mem, 0);
old_font = SelectObject(hdc_mem, h_font);
DrawText(hdc_mem, text_tab[i], size(text_tab[i]), address(#rect_tab[i][0]), DT_CENTER);
//SelectObject(hdc_mem, old_font);
}
old_brush = SelectObject(hdc_mem, brush1);
RoundRect(hdc_mem, 10, 30, 500, 250, 10, 10);
//old_brush = SelectObject(hdc_mem, brush_fon);
RoundRect(hdc_mem, cord_control_buttons[0][0], cord_control_buttons[0][1], cord_control_buttons[0][2], cord_control_buttons[0][3], 10, 10);
//SelectObject(hdc_mem, old_brush);
DrawText(hdc_mem, Control_text_buttons[0], size(Control_text_buttons[0]), address(#cord_control_buttons[0][0]), DT_CENTER);//Добваить + возле вкладки
SelectObject(hdc_mem, old_brush);
SelectObject(hdc_mem, old_pen);
BitBlt(hdc, 0, 0, image_width, image_height, hdc_mem, 0, 0, SRCCOPY);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
(Добавление)
Zireael пишет: Цитата: Как теперь считать:
Добавить переменную, в которой хранить сколько всего вкладок. В массив int rect_tab[3][4]; записывать координаты вкладок. Рисовать в цикле, сколько вкладок добавили в массив, столько и нарисует. Так нет. Нужно, что бы не все сразу рисовал, а нажали "+", она сместилась и создалась одна вкладка, потом снова повторяется.
(Добавление)
Максимально планирую 3 вкладки.
(Добавление)
Вот пока что вышло, но не через циклКод (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define PS_SOLID 0
#define PS_NULL 5
#define SRCCOPY 13369376
#define TRANSPARENT 1
#define DT_CENTER 1
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "RoundRect", "RoundRect", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "PtInRect", "PtInRect", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "DrawText", "DrawTextA", "User32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "Ellipse", "Ellipse", "Gdi32.dll");
#definefile "C:\Users\Home\Desktop\kibor_set\Constants.txt";
int h_font, old_font;
int mouseX, mouse_Y;
int hdc, hdc_mem, hdc_bitmap;
int pen, brush1, brush2, brush_fon, old_pen, old_brush;
pen = CreatePen(PS_NULL, 0, 0);
brush_fon = CreateSolidBrush(14013909);
brush1 = CreateSolidBrush(4307199);
brush2 = CreateSolidBrush(3309517);
int current_tab = 0;
int rect_tab[3][4];
int created_tab = 0;;
//rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
//rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=280; rect_tab[1][3]=40;
//rect_tab[2][0]=240; rect_tab[2][1]=15; rect_tab[2][2]=255; rect_tab[2][3]=30;//240 10 320 40
string text_tab[3] = {"Пустая вкладка1", "Новая вкладка2", "Новая вкладка3"};
string Control_text_buttons[2] = {"+", "-"};
int cord_control_buttons[2][4];
cord_control_buttons[0][0] = 25; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 47; cord_control_buttons[0][3] = 31;//+ нету вкладки
//cord_control_buttons[0][0] = 154; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 176; cord_control_buttons[0][3] = 31;//+ 1 вкладка
//cord_control_buttons[0][0] = 284; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 306; cord_control_buttons[0][3] = 31;//+ 2 вкладка
//cord_control_buttons[1][0] = 10; cord_control_buttons[1][1] = 10; cord_control_buttons[1][2] = 10; cord_control_buttons[1][3] = 10;//-
int image_width = 600;
int image_height = 500;
createdialog(0);
showdialog(0, "BALLOON BOT", 200, 200, 515, 500, 1, 1);
enabletimer(0);
//-----------------------------------------------------------------------------------------------------------------------------------------------------
loop()
{
sleep(10);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_CREATE)
{
hdc = GetDC(gethwnd(0));
hdc_mem = CreateCompatibleDC(hdc);
hdc_bitmap = CreateCompatibleBitmap(hdc, image_width, image_height);
SelectObject(hdc_mem, hdc_bitmap);
SetBkMode(hdc_mem, TRANSPARENT);
h_font = CreateFont(-14, 0, 0, 0, 500, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Comic Sans MS");
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function getmessage(0, WM_MOVE)
{
pause(100);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE_TIMER(0, 30)
{
if(getkeystate(1))
{
while(getkeystate(1))
{
sleep(10);
}
for(int tab_=0; tab_<sizearray(rect_tab); tab_++)
{
getmouse(mouseX, mouse_Y, formatiw(gethwnd(0)));
if(PtInRect(address(#rect_tab[tab_][0]), mouseX, mouse_Y))
{
current_tab=tab_;
break;
}
//======
if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
created_tab++;
if (created_tab == 1)
{
rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
cord_control_buttons[0][0] = 154; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 176; cord_control_buttons[0][3] = 31;//+ 1 вкладка
}
if (created_tab == 2)
{
rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=280; rect_tab[1][3]=40;
cord_control_buttons[0][0] = 284; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 306; cord_control_buttons[0][3] = 31;//+ 2 вкладка
}
break;
}
}
}
paint();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
function paint()
{
old_pen = SelectObject(hdc_mem, pen);
old_brush = SelectObject(hdc_mem, brush_fon);
Rectangle(hdc_mem, 0, 0, image_width+1, image_height+1);
SelectObject(hdc_mem, old_brush);
for(int i=0; i<sizearray(rect_tab); i++)
{
if(i == current_tab)
{
old_brush = SelectObject(hdc_mem, brush1);
}
else
{
old_brush = SelectObject(hdc_mem, brush2);
}
RoundRect(hdc_mem, rect_tab[i][0], rect_tab[i][1], rect_tab[i][2], rect_tab[i][3], 10, 10);
SelectObject(hdc_mem, old_brush);
SetTextColor(hdc_mem, 0);
old_font = SelectObject(hdc_mem, h_font);
DrawText(hdc_mem, text_tab[i], size(text_tab[i]), address(#rect_tab[i][0]), DT_CENTER);
//SelectObject(hdc_mem, old_font);
}
old_brush = SelectObject(hdc_mem, brush1);
RoundRect(hdc_mem, 10, 30, 500, 250, 10, 10);
//old_brush = SelectObject(hdc_mem, brush_fon);
RoundRect(hdc_mem, cord_control_buttons[0][0], cord_control_buttons[0][1], cord_control_buttons[0][2], cord_control_buttons[0][3], 10, 10);
//SelectObject(hdc_mem, old_brush);
DrawText(hdc_mem, Control_text_buttons[0], size(Control_text_buttons[0]), address(#cord_control_buttons[0][0]), DT_CENTER);//Добваить + возле вкладки
SelectObject(hdc_mem, old_brush);
SelectObject(hdc_mem, old_pen);
BitBlt(hdc, 0, 0, image_width, image_height, hdc_mem, 0, 0, SRCCOPY);
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
Zireael |
Отправлено: 12 Ноября, 2019 - 01:58:45
|
Эксперт
Покинул форум
Сообщений всего: 4456
Дата рег-ции: Нояб. 2017
Репутация: 585
|
Цитата: Просто не дает форум больше 6 МБ загружать
Так может не добавлять комментарии такого вида: //--------------------------------------------------------------------------------------------------------------------------
и всё влезет.
Вот как надо:
code (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define WS_BORDER 8388608
#define PS_SOLID 0
#define PS_NULL 5
#define SRCCOPY 13369376
#define TRANSPARENT 1
#define DT_CENTER 1
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "RoundRect", "RoundRect", "Gdi32.dll");
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "PtInRect", "PtInRect", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll");
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll");
external(INT, "DrawText", "DrawTextA", "User32.dll");
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll");
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "Ellipse", "Ellipse", "Gdi32.dll");
int h_font, old_font;
int mouseX, mouse_Y;
int hdc, hdc_mem, hdc_bitmap;
int pen, brush1, brush2, brush_fon, old_pen, old_brush;
pen = CreatePen(PS_NULL, 0, 0);
brush_fon = CreateSolidBrush(14013909);
brush1 = CreateSolidBrush(4307199);
brush2 = CreateSolidBrush(3309517);
int current_tab = 0; // текущая вкладка
int created_tab = 0; // всего вкладок
int rect_tab[3][4]; // координаты вкладок
rect_tab[0][0]=25; rect_tab[0][1]=10; rect_tab[0][2]=150; rect_tab[0][3]=40;
rect_tab[1][0]=155; rect_tab[1][1]=10; rect_tab[1][2]=280; rect_tab[1][3]=40;
rect_tab[2][0]=285; rect_tab[2][1]=10; rect_tab[2][2]=410; rect_tab[2][3]=40;
string text_tab[3] = {"Game1", "Game2", "Game3"};
string Control_text_buttons[2] = {"+", "-"};
int cord_control_buttons[2][4];
cord_control_buttons[0][0] = 25; cord_control_buttons[0][1] = 10; cord_control_buttons[0][2] = 47; cord_control_buttons[0][3] = 31; // координаты +
int image_width = 600;
int image_height = 500;
createdialog(0);
showdialog(0, "BALLOON BOT", 200, 200, 515, 500, 1, 1);
enabletimer(0);
loop()
{
sleep(10);
}
function getmessage(0, WM_CREATE)
{
hdc = GetDC(gethwnd(0));
hdc_mem = CreateCompatibleDC(hdc);
hdc_bitmap = CreateCompatibleBitmap(hdc, image_width, image_height);
SelectObject(hdc_mem, hdc_bitmap);
SetBkMode(hdc_mem, TRANSPARENT);
h_font = CreateFont(-14, 0, 0, 0, 500, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Comic Sans MS");
}
function getmessage(0, WM_MOVE)
{
pause(100);
}
CREATE_TIMER(0, 30)
{
if(getkeystate(1))
{
while(getkeystate(1))sleep(10);
getmouse(mouseX, mouse_Y, formatiw(gethwnd(0)));
for(int tab_=0; tab_<created_tab; tab_++)
{
if(PtInRect(address(#rect_tab[tab_][0]), mouseX, mouse_Y)) // если нажата вкладка
{
current_tab=tab_;
break;
}
}
// если нажат +
if(PtInRect(address(#cord_control_buttons[0][0]), mouseX, mouse_Y))
{
if(created_tab<3)
{
cord_control_buttons[0][0] = 5 + rect_tab[created_tab][2]; cord_control_buttons[0][2] = 22 + cord_control_buttons[0][0];
created_tab++;
}
}
}
paint();
}
function paint()
{
old_pen = SelectObject(hdc_mem, pen);
old_brush = SelectObject(hdc_mem, brush_fon);
Rectangle(hdc_mem, 0, 0, image_width+1, image_height+1);
SelectObject(hdc_mem, old_brush);
for(int i=0; i<created_tab; i++) // рисуем вкладки
{
if(i == current_tab)old_brush = SelectObject(hdc_mem, brush1);
else old_brush = SelectObject(hdc_mem, brush2);
RoundRect(hdc_mem, rect_tab[i][0], rect_tab[i][1], rect_tab[i][2], rect_tab[i][3], 10, 10);
SelectObject(hdc_mem, old_brush);
SetTextColor(hdc_mem, 0);
old_font = SelectObject(hdc_mem, h_font);
DrawText(hdc_mem, text_tab[i], size(text_tab[i]), address(#rect_tab[i][0]), DT_CENTER);
SelectObject(hdc_mem, old_font);
}
old_brush = SelectObject(hdc_mem, brush1);
RoundRect(hdc_mem, 10, 30, 500, 250, 10, 10); // таб
if(created_tab<3) // если вкладок меньше 3, то рисуем +
{
RoundRect(hdc_mem, cord_control_buttons[0][0], cord_control_buttons[0][1], cord_control_buttons[0][2], cord_control_buttons[0][3], 10, 10);
DrawText(hdc_mem, Control_text_buttons[0], size(Control_text_buttons[0]), address(#cord_control_buttons[0][0]), DT_CENTER);//Добваить + возле вкладки
}
SelectObject(hdc_mem, old_brush);
SelectObject(hdc_mem, old_pen);
BitBlt(hdc, 0, 0, image_width, image_height, hdc_mem, 0, 0, SRCCOPY);
} |
|
|
|