Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles _
MyBase.Paint
' Currently the hatch patterns have values 0 to 52.
Const MIN_PATTERN As Integer = 0
Const MAX_PATTERN As Integer = 52
Dim x As Integer = 10
Dim y As Integer = 10
For i As Integer = MIN_PATTERN To MAX_PATTERN
DrawHatchSample(e.Graphics, x, y, CType(i, _
HatchStyle))
Next i
End Sub
Private Sub DrawHatchSample(ByVal gr As Graphics, ByRef x _
As Integer, ByRef y As Integer, ByVal hatch_style As _
HatchStyle)
Const TEXT_WID As Integer = 155
Const RECT_WID As Integer = 30
Const RECT_HGT As Integer = 20
Dim br As New HatchBrush(hatch_style, Color.Black, _
Color.White)
gr.DrawString( _
hatch_style.ToString & " (" & CInt(hatch_style) & _
")", _
Me.Font, Brushes.Black, x, y)
gr.FillRectangle(br, x + TEXT_WID, y, RECT_WID, _
RECT_HGT)
gr.DrawRectangle(Pens.Black, x + TEXT_WID, y, RECT_WID, _
RECT_HGT)
y += RECT_HGT + 10
If y + RECT_HGT > Me.ClientSize.Height Then
x += TEXT_WID + RECT_WID + 30
y = 10
End If
End Sub
|