Visual Basic.NET - reset matrix class no funciona

 
Vista:

reset matrix class no funciona

Publicado por ruben murillo (1 intervención) el 19/01/2020 16:38:54
Yo quiero dibujar la primera figura rotada y la segunda, no. Cuando ejecuto el código no muestra la primera figura y rota la segunda. No se porque no muestra la primera figura y rota la segunda pareciera que el reset no funciona. Es necesario mantener el orden en que se dibujan las figuras.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Private Sub Form17_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    Dim x, y As Integer
    e.Graphics.SmoothingMode = SmoothingMode.HighQuality
    'Figura 1
    Dim Mx As Matrix = New Matrix()
    x = 59 : y = 25
    Mx.RotateAt(90, New Point(x, y), MatrixOrder.Append)
    e.Graphics.Transform = Mx
    e.Graphics.DrawEllipse(New Pen(Color.Green, 1), New Rectangle(x + 3, y - 5, 10, 10))
    e.Graphics.DrawLine(New Pen(Color.Green, 1), x, y - 2, x + 13, y - 2)
    e.Graphics.DrawLine(New Pen(Color.Green, 1), x, y + 2, x + 13, y + 2)
    e.Graphics.DrawLine(New Pen(Color.Green, 1), x + 8, y - 5, x + 8, y + 5)
    Mx.Reset()
    'Figura 2
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 1), New Rectangle(x + 3, y - 5, 10, 10))
    e.Graphics.DrawLine(New Pen(Color.Blue, 1), x, y - 2, x + 13, y - 2)
    e.Graphics.DrawLine(New Pen(Color.Blue, 1), x, y + 2, x + 13, y + 2)
    e.Graphics.DrawLine(New Pen(Color.Blue, 1), x + 8, y - 5, x + 8, y + 5)
End Sub

Aparentemente el codigo esta bien, pero no hace lo que deberia hacer. Que esta mal.........
De antemano mis agradecimientos por cualquier ayuda.

Gustavo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder