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

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

Анимация кнопки, значка в трее, окне





Скачать архив

Code
Enumeration  
  #Window_0
  #icon1
  #tamer
  #But
  #tray
EndEnumeration
Global a
Procedure ICON_TRAY()
If EventTimer()=#tamer
  a=a+1  
  If a=1
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon1))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon1))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon1))
  ElseIf a=2
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon2))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon2))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon2))
  ElseIf a=3
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon3))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon3))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon3))
  ElseIf a=4
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon4))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon4))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon4))
  ElseIf a=5
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon5))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon5))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon5))
  ElseIf a=6
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon6))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon6))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon6))
  ElseIf a=7
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon7))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon7))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon7))
  ElseIf a=8
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon8))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon8))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon8))
  ElseIf a=9
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon9))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon9))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon9))
  ElseIf a=10
  SetGadgetAttribute(#But,#PB_Button_Image, CatchImage(#icon1,?icon10))
  SetWindowIcon(WindowID(#Window_0),CatchImage(#icon1,?icon10))
  ChangeSysTrayIcon(#tray, CatchImage(#icon1,?icon10))
  ElseIf a=11
  a=0
  EndIf  
  EndIf  
EndProcedure  

OpenWindow(#Window_0,0,0,400,200,"Анимация на кнопе, в трее, иконка в окне",#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
AddWindowTimer(#Window_0, #tamer, 100)
AddSysTrayIcon(#tray,WindowID(#Window_0),CatchImage(#icon1,?icon1))
ButtonImageGadget(#But,20,20,60,25,0)
Repeat
Event =WaitWindowEvent()  
Window =EventWindow()  
Gadget =EventGadget()
  Select Event
  Case #PB_Event_Timer
  ICON_TRAY()
  Case #PB_Event_Gadget
  Select EventGadget()
  Case 1
  Case 2
  Case 3
  EndSelect
  EndSelect
If Event = #PB_Event_CloseWindow
Break  
EndIf
ForEver
DataSection  
  icon1: IncludeBinary "1.ico"
  icon2: IncludeBinary "2.ico"
  icon3: IncludeBinary "3.ico"
  icon4: IncludeBinary "4.ico"
  icon5: IncludeBinary "5.ico"
  icon6: IncludeBinary "6.ico"
  icon7: IncludeBinary "7.ico"
  icon8: IncludeBinary "8.ico"
  icon9: IncludeBinary "9.ico"
  icon10: IncludeBinary "10.ico"
EndDataSection












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