Date: 02-16-2022
Return to Index
'Compilable Example: (Jose Includes)
created by gbSnippets
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_GraphicA = 500
%IDC_GraphicB = 501
%IDC_Copy = 502
Global hDlg As Dword, bmp$
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,450,500, %WS_OverlappedWindow + %CS_HRedraw + %CS_VRedraw To hDlg
Control Add Button, hDlg, %IDC_Copy, "Copy", 10,10,100,20
Control Add Graphic, hDlg, %IDC_GraphicA, "", 10,60,400,200
Graphic Attach hDlg, %IDC_GraphicA
Control Add Graphic, hDlg, %IDC_GraphicB, "", 10,280,400,200
Graphic Render "cowboy.bmp", (0,0)-(399,199)
Graphic Get Bits To bmp$
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local x, y As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Copy
Dim Colors(0 To 399, 0 To 199) As Long At StrPtr(bmp$) + 8
Graphic Attach hDlg, %IDC_GraphicB
For x = 0 To 199
For y = 0 To 199
Swap Colors(x,y), Colors(400-x,y)
Next Y
Next x
Graphic Set Bits bmp$
End Select
End Select
End Function
'gbs_00860
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm