Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

  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??

Visit http://www.nico.gotdns.com

 

Now ONLINE!

  • *Experts*
Posted

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()

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...