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"
Global hDlg,hGraphic As Dword
%IDC_Graphic = 500
Function PBMain() As Long
Dialog New Pixels, 0, "Parent",300,300,800,600, %WS_OverlappedWindow To hDlg
Control Add Graphic, hDlg, %IDC_Graphic, "",10,10,75,25, %WS_Border
Control Handle hDlg, %IDC_Graphic To hGraphic
Graphic Attach hDlg, %IDC_Graphic
Graphic Set Virtual 800,1000
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local w,h,i As Long, pt As Point
Select Case Cb.Msg
Case %WM_InitDialog
For i = 0 To 100 : Graphic Print "Now is the " + Trim$(i) : Graphic Print : Graphic Print : Next i
Case %WM_ContextMenu
GetCursorPos pt
ScreenToClient hGraphic, pt
pt.x = pt.x + Graphic(View.X)
pt.y = pt.y + Graphic(View.Y)
Dialog Set Text hDlg, Trim$(pt.x) + ":" + Trim$(pt.y) + " " + Time$
Case %WM_Size
Dialog Get Client hDlg To w,h
Control Set Size hDlg, %IDC_Graphic, w-20,h-20
End Select
End Function
'gbs_01045
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm