Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
Enum Equates Singular
IDC_Button = 500
IDC_Graphic
End Enum
Global hDlg,hFont As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,410,400, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Push", 50,10,100,20
Control Add Graphic, hDlg, %IDC_Graphic,"", 10,40,390,350
Graphic Attach hDlg, %IDC_Graphic, ReDraw
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
Local i As Long
For i = 1 To 5 : DrawStuff(i) : Next i
End Select
End Select
End Function
Sub DrawStuff(i As Long)
Graphic Width 20
Graphic Color %Yellow, %Blue
Graphic Clear
Graphic Line (10,10)-(380,10)
Graphic Set Pos(20,50)
Font New "Tahoma",i*16,1 To hFont
Graphic Set Font hFont
If i Then Graphic Print Left$(Time$,5)
Graphic ReDraw
Sleep 1000
End Sub
http://www.garybeene.com/sw/gbsnippets.htm