Drawing Lines In VB 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BarryM
    New Member
    • Mar 2008
    • 32

    Drawing Lines In VB 2005

    Iv got a panel on the main form which is set to auto scroll. In the panel there is a picture box that i draw lines in. the lines work perfectly fine until the scroll bar comes up. The picture box expands in the scrollable panel but the program wont allow the lines to continuing drawing(vb 2005)

    here's the coding
    [coding]
    Public Class Form1

    Dim DrawGraphics As Graphics
    Dim DrawBitmap As Bitmap

    Dim y2 As Integer
    Dim x2 As Integer = 10
    Dim y1 As Integer = 0
    Dim x1 As Integer = 0
    Dim score As Integer
    Dim avg As New ListBox

    Private Sub btnenter_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnenter.Click
    'picgra.Width = x2 + 25
    ' the value of the score on the grapgh is y2

    picgra.Width = x2 + 30
    y2 = System.Convert. ToInt64(txtscor e.Text)
    x2 = x1 + 10
    y2 = y2 * 2
    avg.Items.Add(s core)
    DrawGraphics.Dr awLine(Pens.Lig htGreen, x1, y1, x2, y2)
    picgra.Image = DrawBitmap
    y1 = y2
    x1 = x2
    Me.Text = x2



    End Sub

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    'lblsize.Width = pnl1.Width
    'picgra.Width = pnl1.Width
    tmrdraw.Start()
    tmrdraw.Interva l = 1
    DrawBitmap = New Bitmap(picgra.W idth, picgra.Height)
    DrawGraphics = Graphics.FromIm age(DrawBitmap)
    picgra.Image = DrawBitmap

    End Sub


    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
    picgra.Width = 600
    ' DrawGraphics.Dr awLine(Pens.Lig htGreen, 0, 0, 600, 150)
    'picgra.Image = DrawBitmap
    End Sub
    End Class
    [/code]
    if you have any idea on how i could fix it please post and i dont want to resort to having to import seperate programs into vb
Working...