NicoVB Posted June 30, 2003 Posted June 30, 2003 button1_Click pnlLinks.Invalidate() Dim i As Object For each i In concoll i.BackColor = Color.Transparent Next Dim g As Graphics g = pnlLinks.CreateGraphics g.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#003366")), rect) g.DrawRectangle(New Pen(ColorTranslator.FromHtml("#99FF00")), rect) CTL.BackColor = ColorTranslator.FromHtml("#003366") CType(CTL.Tag, Panel).BackColor = ColorTranslator.FromHtml("#003366") g.Dispose() This is the code I use for my drawing of a rectangle. But what happens: I can see that there is drawn a rectangle one millisecond, but the rectangle disappears instantly. Why is that?? Quote Visit http://www.nico.gotdns.com Now ONLINE!
NicoVB Posted July 1, 2003 Author Posted July 1, 2003 This is really easy I think. I'm just doing something very simple wrong. What is it? Quote Visit http://www.nico.gotdns.com Now ONLINE!
*Experts* Volte Posted July 1, 2003 *Experts* Posted July 1, 2003 You need to put all drawing code in your Paint event, otherwise it will simply be painted over as soon as you draw on it. If you want to force the control to redraw itself do this:[i]Control[/i].Invalidate() Quote
Hamburger1984 Posted July 1, 2003 Posted July 1, 2003 Wrote a Testapp... (see attachment)drawingrectangles.zip Quote
NicoVB Posted July 2, 2003 Author Posted July 2, 2003 Thank you guys for your valuable information!!! :) Quote Visit http://www.nico.gotdns.com Now ONLINE!
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.