Click here to Skip to main content
15,881,803 members
Home / Discussions / C#
   

C#

 
GeneralRe: Textbox: Convert to float and backwards Pin
OmegaSupreme2-Feb-04 8:43
OmegaSupreme2-Feb-04 8:43 
GeneralRe: Textbox: Convert to float and backwards Pin
Heath Stewart2-Feb-04 9:46
protectorHeath Stewart2-Feb-04 9:46 
GeneralRe: Textbox: Convert to float and backwards Pin
OmegaSupreme2-Feb-04 9:58
OmegaSupreme2-Feb-04 9:58 
GeneralRe: Textbox: Convert to float and backwards Pin
Heath Stewart2-Feb-04 10:04
protectorHeath Stewart2-Feb-04 10:04 
GeneralRe: Textbox: Convert to float and backwards Pin
sps-itsec462-Feb-04 10:20
sps-itsec462-Feb-04 10:20 
GeneralRe: Textbox: Convert to float and backwards Pin
Heath Stewart2-Feb-04 10:26
protectorHeath Stewart2-Feb-04 10:26 
GeneralFlickering Pin
bouli2-Feb-04 7:20
bouli2-Feb-04 7:20 
GeneralRe: Flickering Pin
Heath Stewart2-Feb-04 9:43
protectorHeath Stewart2-Feb-04 9:43 
First of all, when overriding an event handler like OnPaint, always call the method on the base class (ex, base.OnPaint) unless you have a VERY good reason not too. The base class might have things it needs to do as well, and if you don't the Paint event won't be fired for other, outside classes to handle. Also, whenever you're done with a Bitmap, call Dispose on it or memory consumption increases rapidly. This could be one reason for the flickering. The GC will clean it up eventually, but not in a timely enough manner - especially when the app is busy doing a lot of repainting that occurs when you resize.

Also, for things that don't change - like your Pen, you can store these as fields if time is a big issue, but you should normally dispose those as well.

Finally, you can call SetStyle with ControlStyles.AllPaintingInWmPaint, ControlStyles.DoubleBuffer, and ControlStyles.UserPaint in order to tell the Framework (or rather the underlying system resources) to use double-buffering when painting. This works in most cases.

 

Microsoft MVP, Visual C#
My Articles
GeneralGDI+ Pin
bouli2-Feb-04 5:00
bouli2-Feb-04 5:00 
GeneralRe: GDI+ Pin
Mazdak2-Feb-04 5:17
Mazdak2-Feb-04 5:17 
GeneralRe: GDI+ Pin
bouli2-Feb-04 5:18
bouli2-Feb-04 5:18 
GeneralRe: GDI+ Pin
Mazdak2-Feb-04 5:27
Mazdak2-Feb-04 5:27 
GeneralRe: GDI+ Pin
bouli2-Feb-04 5:30
bouli2-Feb-04 5:30 
Generalpassword checking Pin
ASGill2-Feb-04 2:33
ASGill2-Feb-04 2:33 
GeneralRe: password checking Pin
Rhys__6662-Feb-04 3:04
Rhys__6662-Feb-04 3:04 
GeneralRe: password checking Pin
Heath Stewart2-Feb-04 3:15
protectorHeath Stewart2-Feb-04 3:15 
GeneralC# Standard Template Library Pin
TeamWild2-Feb-04 1:11
TeamWild2-Feb-04 1:11 
GeneralRe: C# Standard Template Library Pin
Colin Angus Mackay2-Feb-04 1:36
Colin Angus Mackay2-Feb-04 1:36 
GeneralRe: C# Standard Template Library Pin
TeamWild2-Feb-04 2:00
TeamWild2-Feb-04 2:00 
GeneralRe: C# Standard Template Library Pin
Colin Angus Mackay2-Feb-04 2:35
Colin Angus Mackay2-Feb-04 2:35 
GeneralRe: C# Standard Template Library Pin
Judah Gabriel Himango2-Feb-04 8:25
sponsorJudah Gabriel Himango2-Feb-04 8:25 
GeneralRe: C# Standard Template Library Pin
Nemanja Trifunovic2-Feb-04 12:07
Nemanja Trifunovic2-Feb-04 12:07 
GeneralRe: C# Standard Template Library Pin
Heath Stewart2-Feb-04 3:04
protectorHeath Stewart2-Feb-04 3:04 
GeneralRe: C# Standard Template Library Pin
boogs2-Feb-04 9:01
boogs2-Feb-04 9:01 
GeneralClickety Pin
Colin Angus Mackay2-Feb-04 11:57
Colin Angus Mackay2-Feb-04 11:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.