📄 windowii.pb
字号:
;//////////////////////////////////
; Amlinger
; by 2008 02 11
;描述:创建带有关于的窗口
;目标:多个窗口的创建 与消息的传递
;//////////////////////////////////
;//// Main&AboutWindow ////
;- Window Constants
;
;枚举 常量声明
Enumeration
#Main
#About
#Text_0
#Frame3D_0
#Frame3D_1
#Text_1
#OK_Button_0
EndEnumeration
;- Fonts
;加载字体
Global FontID1
FontID1 = LoadFont(1, "Arial", 20)
Global FontID2
FontID2 = LoadFont(2, "Arial", 16)
;主窗口创建过程函数
Procedure Open_Main()
If OpenWindow(#Main, 405, 334, 431, 100, "Main Window", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
;建立对象列表
If CreateGadgetList(WindowID(#Main))
;增加文字框
TextGadget(#Text_0, 40, 30, 340, 80, "Main Window", #PB_Text_Center)
;设置字体
SetGadgetFont(#Text_0, FontID1)
;设置框架样式
Frame3DGadget(#Frame3D_0, 100, 10, 220, 70, "")
EndIf
EndIf
EndProcedure
;关于窗口创建的函数
Procedure Open_About()
If OpenWindow(#About, 452, 518, 258, 152, "About", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#About))
Frame3DGadget(#Frame3D_1, 10, 10, 240, 80, "")
TextGadget(#Text_1, 20, 30, 220, 60, "About Window", #PB_Text_Center)
SetGadgetFont(#Text_1, FontID2)
ButtonGadget(#OK_Button_0, 90, 110, 80, 30, "Ok")
EndIf
EndIf
EndProcedure
;//////////////////////////////
;//////////////////////////////
;//// 这里是开始的地方 //////
Start:
Open_Main()
Open_About()
Repeat
;获取事件类型
Event = WaitWindowEvent()
;获以事件发生对象句柄
WindowID = EventWindow()
;如果是关于窗口的事件
If WindowID = #About
;如果是关闭消息
If Event = #PB_Event_CloseWindow
;关闭关于窗口
CloseWindow(#About)
EndIf
If Event = #PB_Event_Gadget
;获取 对象 ID号
GadgetID = EventGadget()
;如果是 Ok 按钮则关闭 关于 窗口
If GadgetID = #OK_Button_0
CloseWindow(#About)
EndIf
EndIf
EndIf
;如果 事件对象ID号是主窗口 并且 是关闭事件的话 则退出本程序 否则一直显示当前窗口
Until WindowID = #Main And Event = #PB_Event_CloseWindow
End
; IDE Options = PureBasic 4.10 (Windows - x86)
; CursorPosition = 27
; FirstLine = 18
; Folding = -
; EnableXP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -