Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27055

VS 2010 GDI+ Drawline in panel with paint event

$
0
0
Evening Guys, looking for a little education on this subject.

I'm trying to create a "divider" line in between panels on a group box, these line positions move when a selection is made within a combobox or textbox in the panels, so the line position is not predictable. I've had this working with creategraphics but obviously it wont persist. I just dont understand the concept of the paint event - how it's applied, how it's fired etc.

Code so far below, I'm getting "argument not specified for parameter "e"

Code:

    Private Sub Shnozz_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Shnozz.TextChanged

        Call Nozznochange()

    End Sub


    Private Sub nozzlenochange(ByVal e As PaintEventArgs)

        Dim nextnozz As Integer
        Dim X1 As Integer
        Dim X2 As Integer
        Dim Y1 As Integer
        Dim Y2 As Integer
        Dim Pens As New Pen(Color.Gainsboro, 3)

        X1 = 9
        X2 = 730



        If Shnozz.Text = "1" Then
            S1.Visible = True
            S1.Location = New Point(9, 65)
            nextnozz = S1.Top + S1.Height + 8
            Y1 = nextnozz - 4
            Y2 = nextnozz - 4
            e.Graphics.DrawLine(Pens, New Point(X1, Y1), New Point(X2, Y2))
        ElseIf Shnozz.Text = "2" Then
            S1.Location = New Point(9, 65)
            S1.Visible = True
            nextnozz = S1.Top + S1.Height + 8
            Y1 = nextnozz - 4
            Y2 = nextnozz - 4
            e.Graphics.DrawLine(Pens, New Point(X1, Y1), New Point(X2, Y2))
            S2.Top = nextnozz
            S2.Visible = True
            nextnozz = S2.Top + S2.Height + 8
            Y1 = nextnozz - 4
            Y2 = nextnozz - 4
            e.Graphics.DrawLine(Pens, New Point(X1, Y1), New Point(X2, Y2))

            e.Dispose()
            Pens.Dispose()



        End If
    End Sub


Viewing all articles
Browse latest Browse all 27055

Trending Articles