Linien innerhalb der Picturebox

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von Le0n.

    Linien innerhalb der Picturebox

    Hallo,

    wie kann ich bei VB2008 Linien nur innerhalb einer Picturebox zeichnen lassen?

    bei VB2006 hatte ich das noch so gelöst:

    With Picturebox1
    Picturebox1.Scale (0, 1.6)-(2 * pi, -1.6)
    Picturebox1.Line (0, 0)-((5 / 2) * pi, 0), RGB(0, 0, 255)
    End Picturebox1


    Das Zeichnen einer Linie habe ich bis jetzt so hinbekommen:

    Dim g As Graphics = e.Graphics
    g.DrawLine(Pens.Red, 10, 10, 10, 190)

    Möchte aber wie gesagt, dass meine Linie nur innerhalb der Picturebox gezeichnet wird.

    Vielen Dank für jeden Rat
    Hallo

    In PictureBox zeichnen:

    VB.NET-Quellcode

    1. Dim g As Graphics = PictureBox1.CreateGraphics
    2. g.DrawLine(Pens.Red, 10, 10, 10, 190)


    oder im Paint Ereignis:

    VB.NET-Quellcode

    1. Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
    2. Dim g As Graphics = e.Graphics
    3. g.DrawLine(Pens.Red, 10, 10, 10, 190)
    4. End Sub