Results 1 to 3 of 3

Thread: Form initialization question? [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157

    Form initialization question? [RESOLVED]

    Hi,
    I am using VB Net.

    I have a form, a picture box and a sub procedure that draws a circle in the picture box.

    The behavior I desire is for the form to load and then to call the sub procedure to draw the circle. At this point a circle should be in the picture box.

    I have experimented with placing the call in various form events. The best I can get is that the circle shows up for an instant and then disappears.

    Where I can I place this call so that the circle is persistent after loading the form? Should I be using some protected override?

    I can do this with a timer that provides a short amount of time for the form to finish loading and displaying. I would rather do it another way if possible.

    Thanks,
    ChuckB
    Last edited by ChuckB; May 10th, 2004 at 11:20 AM.
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Something like this:

    VB Code:
    1. Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
    2.         Me.Update()
    3.         Dim tPen As New Pen(System.Drawing.Color.Red)
    4.  
    5.         PictureBox1.CreateGraphics.DrawEllipse(tPen, 0, 0, 50, 50)
    6.     End Sub

  3. #3

    Thread Starter
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Thanks! That was exactly what was needed.
    ChuckB
    I learn Robotics, Electronics and Game Programming at http://www.gameinstitute.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width