Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Resource "gbsnippets.pbr"
%IDC_CheckBox = 500
Global hDlg As Dword, gCount As Long
Function PBMain() As Long
gCount = 1000
Dialog New Pixels, 0, "Graphic Resize Test",300,300,100,120, %WS_OverlappedWindow Or %WS_ClipChildren, 0 To hDlg
Control Add Graphic, hDlg, gCount,"", 0,20,100,100, %SS_OwnerDraw
Control Add CheckBox, hDlg, %IDC_CheckBox,"Anti-Flicker",0,0,100,20
Graphic Attach hDlg, gCount, ReDraw
Graphic Render "cowgirl", (0,0)-(99,99) 'same size (could resize)
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local w,h,iResult As Long
Select Case Cb.Msg
Case %WM_Size
Control Get Check hDlg, %IDC_CheckBox To iResult
If iResult=0 Then
Dialog Get Client hDlg To w,h
Control Kill hDlg, gCount
Control Add Graphic, hDlg, gCount,"", 0,20,w,h-20
Graphic Attach hDlg, gCount
Graphic Render "cowgirl", (0,0)-(w,h) 'same size (could resize)
Else
Dialog Get Client hDlg To w,h
Incr gCount
Control Add Graphic, hDlg, gCount,"", 0,20,w,h-20,%SS_OwnerDraw
Graphic Attach hDlg, gCount, ReDraw
Graphic Render "cowgirl", (0,0)-(w,h) 'same size (could resize)
Control Kill hDlg, gCount-1
End If
End Select
End Function
'gbs_00785
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm