• Viernes 8 de Noviembre de 2024, 13:25

Autor Tema:  echenle ojo a este programa  (Leído 859 veces)

piojoso

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
echenle ojo a este programa
« en: Jueves 8 de Abril de 2010, 00:54 »
0
hola mi problema es este debo de dibujar un triangulo despues e yo lo debo de reyenar linea por linea. el codigo que ya e realisado es este y solo me dibuja el triangulo y no tengo idea como aser el reyenado

Public Class Form1
    Dim s(1) As Integer
    Dim f(1) As Integer
    Dim p(1) As Integer

    Dim p1 As PointF
    Dim p2 As PointF
    Dim p3 As PointF
    Dim p4 As Point
    Dim p5 As Point
    Dim punta As Pen
    Private Sub PictureBox1_paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
        Dim Point As PointF() = {p1, p2, p3}

        If TextBox1.Text = "" Then '//x1
            s(0) = 0
        Else
            s(0) = CInt(TextBox1.Text)
        End If
        If TextBox2.Text = "" Then '//y1
            s(1) = 0
        Else
            s(1) = CInt(TextBox2.Text)
        End If
        If TextBox3.Text = "" Then '//x2
            f(0) = 0
        Else
            f(0) = CInt(TextBox3.Text)
        End If
        If TextBox4.Text = "" Then '//y2
            f(1) = 0
        Else
            f(1) = CInt(TextBox4.Text)
        End If
        If TextBox5.Text = "" Then '//x3
            p(0) = 0
        Else
            p(0) = CInt(TextBox5.Text)
        End If
        If TextBox6.Text = "" Then '//y3
            p(1) = 0
        Else
            p(1) = CInt(TextBox6.Text)
        End If

        punta = New Pen(Color.Black, 1) 'un lapiz del color negro
        p1 = New Point(s(0), s(1)) 'Point(x1,y1)
        p2 = New Point(f(0), f(1)) 'Point(x2,y2)
        p3 = New Point(p(0), f(1)) 'Point(x3,y3)
        e.Graphics.DrawPolygon(punta, Point)
        e.Graphics.DrawLine(punta, p1, p3)
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PictureBox1.Refresh()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        PictureBox1.Image = Nothing
    End Sub
End Class