Date: 02-16-2022
Return to Index
created by gbSnippets
'... this snippet is in work
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Include "GDIPlus_Simple.inc"
%IDC_Button = 500 : %IDC_Graphic = 501
Global hDlg, hDC as Dword
Function PBMain() As Long
'initialize GDIPlus
Local token As Dword, StartupInput As GdiplusStartupInput
StartupInput.GdiplusVersion = 1
GdiplusStartup(token, StartupInput, ByVal %NULL)
'normal app stuff
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Push", 50,10,100,20
Control Add Graphic, hDlg, %IDC_Graphic, "", 50,40,100,100, %WS_Border
Graphic Attach hDlg, %IDC_Graphic
Graphic Get DC to hDC
Dialog Show Modal hDlg Call DlgProc
'shut downn GDIPlus
GdiplusShutdown token ' Shutdown GDI+
End Function
CallBack Function DlgProc() As Long
Dim iStart As Long, iEnd As Long, Result As String
Select Case Cb.Msg
Case %WM_InitDialog
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button : GDIPlus_Tasks : Graphic Redraw
End Select
Case %WM_Destroy
End Select
End Function
Sub GDIPlus_Tasks
Local pGraphics, pPen As Dword
GdipCreateFromHDC(hDC, pGraphics)
GdipCreatePen1(GDIP_ARGB(255, 255, 0, 0), 1, %UnitPixel, pPen) 'create pen
GdipDrawLineI pGraphics, pPen, 10, 10, 50,50 'draw line
If pPen Then GdipDeletePen(pPen)
If pGraphics Then GdipDeleteGraphics(pGraphics)
End Sub
'gbs_00977
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm