Algar Posted July 21, 2003 Posted July 21, 2003 (edited) I am manualy drawing 2 graphs on a picturebox. I put the drawing code in a routine and call it front the _Paint() event. The problem is: When the form is first loaded its invisible, and when I move the form from halfway off the screen, it won't repaint fully. So basicaly I need a way to make this picturebox repaint no matter what happens Here is the relavent code: ======== Form Load ========= Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Call MakeGraph() Me.SetStyle(ControlStyles.ResizeRedraw, True) Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True) End Sub ======== Control Paint ========= Private Sub picGraph_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles picGraph.Paint Call MakeGraph() End Sub Also to note, it works with other controls, just doesn't seem to want to go with picturebox Edited July 21, 2003 by Algar Quote
*Experts* mutant Posted July 21, 2003 *Experts* Posted July 21, 2003 Im not excatly sure what you need but since you said you need to force repaint try this: PictureBox1.Invalidate() This will make the pic box repaint when you call this. You could call this in your form's move event. Quote
Algar Posted July 21, 2003 Author Posted July 21, 2003 Ok, thanks a lot, works great ! I had already figured out that regraphing on the move event worked, but your way is much less resource intensive Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.