Hi all,
I want to fill two triangles with a texturebrush containing a bitmap image.
The two triangles are drawn .
The left triangle in my code is filled perfect, but the right one does not get filled at all.
I can not figure out what is wrong with my code.
Here is the code:
Can annyone help?
Thanks,
Groover
I want to fill two triangles with a texturebrush containing a bitmap image.
The two triangles are drawn .
The left triangle in my code is filled perfect, but the right one does not get filled at all.
I can not figure out what is wrong with my code.
Here is the code:
VB.NET:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawImage(ball1, ulcorner)
'draw arch orange
Dim startRadius As Single = 60
Dim endRadius As Integer = 60
Dim startAngle As Single = 180
Dim sweepAngle As Single = 180
Dim rect As New Rectangle(0, 15, 604, 300)
Dim arcpen As New Drawing.Pen(Color.Orange, 15)
e.Graphics.DrawArc(arcpen, rect, startAngle, sweepAngle)
'draw rectangle and line
Dim boardPen As New Drawing.Pen(Color.BlueViolet, 10)
Dim boardPen1 As New Drawing.Pen(Color.BlueViolet, 15)
e.Graphics.DrawRectangle(boardPen1, 4, 1, 600, 800)
e.Graphics.DrawLine(boardPen, 540, 200, 540, 800)
''draw left triangle
Dim myPen As New Pen(Color.Blue, 5)
Dim myGraphicsPath As New GraphicsPath
'vertic. line, left triangle
myGraphicsPath.AddLine(14, 700, 14, 794)
e.Graphics.DrawLine(myPen, 14, 700, 14, 794)
'hor.l line,left triangle
myGraphicsPath.AddLine(14, 794, 200, 794)
e.Graphics.DrawLine(myPen, 14, 794, 200, 794)
'diag. line, left triangle
myGraphicsPath.AddLine(14, 700, 200, 794)
e.Graphics.DrawLine(myPen, 14, 700, 200, 794)
'fill right triangle
Dim myRegion As New Region(myGraphicsPath)
Dim myBrush As New TextureBrush(New Bitmap("C:\Users\Hans\documents\visual studio 2010\Projects\Jumpin Jack Flash\Jumpin Jack Flash\Resources\bally.png"))
e.Graphics.FillRegion(myBrush, myRegion)
'draw right triangle
Dim myPen1 As New Pen(Color.Blue, 5)
Dim myGraphicsPathr As New GraphicsPath
'vertic. line, right triangle
myGraphicsPathr.AddLine(534, 700, 534, 794)
e.Graphics.DrawLine(myPen1, 534, 700, 534, 794)
'hor.l line, right triangle
myGraphicsPathr.AddLine(334, 794, 534, 794)
e.Graphics.DrawLine(myPen1, 334, 794, 534, 794)
'diag. line, right triangle
myGraphicsPathr.AddLine(534, 700, 334, 794)
e.Graphics.DrawLine(myPen1, 534, 700, 334, 794)
'fill right triangle
Dim myRegionr As New Region(myGraphicsPathr)
e.Graphics.FillRegion(myBrush, myRegionr)
End Sub
Can annyone help?
Thanks,
Groover