Date: 02-16-2022
Return to Index
created by gbSnippets
'Draws a cross hatch over the surface of a graphic target
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Resource "gbsnippets.pbr"
Global hDlg As Dword, gCount As Long
Function PBMain() As Long
gCount = 1000
Dialog New Pixels, 0, "Test",300,300,150,100, %WS_OverlappedWindow, 0 To hDlg
Control Add Graphic, hDlg, gCount,"", 0,0,150,100, %SS_OwnerDraw
Graphic Attach hDlg, gCount, ReDraw
Graphic Render "cowgirl", (0,0)-(150,100) 'same size (could resize)
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
DrawHatch(100,150,8,%Red) 'w,h,div,color
End Select
End Function
Sub DrawHatch(dx As Long, dy As Long, n As Long, iColor As Long)
Local x,y,x1,x2,y1,y2,m As Long
m = Max(dx,dy)
For x = 0 To m Step m/n
Graphic Line (x,0)-(m,m-x),iColor
Graphic Line (0,x)-(m-x,m),iColor
Graphic Line (x,0)-(0,x),iColor
Graphic Line (x,m)-(m,x),iColor
Next x
End Sub
'gbs_00870
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm