
Originally Posted by
Blupig
I don't know a lot about drawing, but maybe you should look into something a little more complex like DirectX, which is made to handle complicated drawing.
I'm pretty sure I can't use DirectX drawing to draw a control.

Originally Posted by
JuggaloBrotha
Can't you define a new rectangle that's slightly smaller & is offset?
Nope, I tried but the hatch pattern seems relative to the screen and not the rectangle I'm drawing one. In fact, if you let that rectangle move using a timer, then the pattern doesn't move. Try running this with the timer set to 50 ms or something:
Code:
Private i As Integer = 0
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim rect = New Rectangle(i, 50, 50, 50)
'Background
Using backBrush As New SolidBrush(Color.Red)
e.Graphics.FillRectangle(backBrush, rect)
End Using
'First dots
Using dot1Brush As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.Percent20, Color.White, Color.Transparent)
e.Graphics.FillRectangle(dot1Brush, rect)
End Using
'Second dots (offset one pixel)
rect.Offset(0, -1)
Using dot2Brush As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.Percent20, Color.Black, Color.Transparent)
e.Graphics.FillRectangle(dot2Brush, rect)
End Using
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
i += 1
Me.Invalidate()
End Sub
You can see the red square moving to the right but the pattern remains absolutely fixed in place (though it's only visible inside the red square).