Date: 02-16-2022
Return to Index
created by gbSnippets
'Image and ImageX controls load from a resource file (*.pbr)
'When the controls are created, their images are loaded by name from a resource file.
'Image control resizes to fit dimensions of image
'ImageX control size is fixed. The image is resized to fit the size of the control.
'Primary Code:
Control Add Image, hDlg, 100,"cowgirl", 20,10,200,200 'cowgirl is name of image in PBR
Control Add Image, hDlg, 200,"cowgirl", 20,10,200,200 'cowgirl is name of image in PBR
'Compilable Example: (Jose Includes)
'In this example, a 100x100 image ("cowgirl") residing in the
'resource file called "cowgirl" is put in both controls - Image and ImageX.
'The 200x200 Image control shrinks to 100x100
'The 200x200 ImageX control size does not change. The image grows to fit the control.
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Include "Win32API.inc"
#Resource "gbsnippets.pbr"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,400,250, %WS_OverlappedWindow To hDlg
Control Add Image, hDlg, 100,"cowgirl", 20,10,200,200
Control Add ImageX, hDlg, 200,"cowgirl", 140,10,200,200
Dialog Show Modal hDlg
End Function
'gbs_00174
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm