* * *    
Главная » Статьи » Код PB

Просмотров: 1353 | Дата: 19.04.2024 | Коментарии (0)

Изменение размера кнопки



Code
Enumeration  
#button1  
#button2  
#button3  
EndEnumeration  
Procedure GetCurrentButton(window)  
currentbutton = -1  
For thisbutton = #button1 To #button3  
br.RECT  
br\left = GadgetX(thisbutton)  
br\top = GadgetY(thisbutton)  
br\right = br\left+GadgetWidth(thisbutton)  
br\bottom = br\top+GadgetHeight(thisbutton)  
If WindowMouseX(window)>=br\left And WindowMouseX(window)<=br\right  
If WindowMouseY(window)>=br\top And WindowMouseY(window)<=br\bottom  
currentbutton = thisbutton  
Break  
EndIf  
EndIf  
Next  
ProcedureReturn currentbutton  
EndProcedure  
OpenWindow(0,0,0,320,240,"Mouseover Button Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)  
CreateGadgetList(WindowID(0))  
ButtonGadget(#button1, 20, 40, 100, 20, "Button 1")  
ButtonGadget(#button2, 20, 80, 100, 20, "Button 2")  
ButtonGadget(#button3, 20, 120, 100, 20, "Button 3")  
currentbutton = -1  
lastbutton=-1  
Repeat  
EventID = WaitWindowEvent(20)  
currentbutton = GetCurrentButton(0)  
If currentbutton <> lastbutton  
If IsGadget(lastbutton)  
ResizeGadget(lastbutton, 20, #PB_Ignore, 100, 20)  
EndIf  
If IsGadget(currentbutton)  
ResizeGadget(currentbutton, 16, #PB_Ignore, 110, 26)  
EndIf  
lastbutton = currentbutton  
EndIf  
Until EventID = #PB_Event_CloseWindow










Сайт посвящён языку программирования PureBasic — коммерческий компилятор языка программирования, использующего синтаксис BASIC. Предназначен для создания кроссплатформенных приложений для AmigaOS, Linux, Microsoft Windows, Windows NT и Mac OS X. Разработан компанией Fantaisie Software.