Click here to Skip to main content
15,915,053 members
Home / Discussions / C#
   

C#

 
AnswerRe: Indexing a property that returns an array. Pin
dojohansen18-Oct-09 0:59
dojohansen18-Oct-09 0:59 
QuestionCouple of questions regarding Windows Service in C# Pin
Aryan S16-Oct-09 17:14
Aryan S16-Oct-09 17:14 
AnswerRe: Couple of questions regarding Windows Service in C# Pin
Dave Kreskowiak16-Oct-09 18:22
mveDave Kreskowiak16-Oct-09 18:22 
AnswerRe: Couple of questions regarding Windows Service in C# Pin
PIEBALDconsult17-Oct-09 5:40
mvePIEBALDconsult17-Oct-09 5:40 
QuestionForm flickering problem Pin
SimpleData16-Oct-09 9:55
SimpleData16-Oct-09 9:55 
AnswerRe: Form flickering problem Pin
Luc Pattyn16-Oct-09 10:25
sitebuilderLuc Pattyn16-Oct-09 10:25 
GeneralRe: Form flickering problem Pin
SimpleData16-Oct-09 11:24
SimpleData16-Oct-09 11:24 
GeneralRe: Form flickering problem Pin
Luc Pattyn16-Oct-09 12:40
sitebuilderLuc Pattyn16-Oct-09 12:40 
OK,

so you don't have list stuff (ListBox, ListView, TreeView, DataGridView), that is good.

here are things that help in reducing flicker:
- keep the GUI simple (keep the number of Controls below say 50)
- make sure you have high-performance code in the paint handlers, if any (don't create too many objects,
Pens, Fonts, ...; and if you have those, don't forget to Dispose the ones you created)
- use the Graphics from PaintEventArgs, don't use CreateGraphics
- all the above should result in fast painting
- apply double-buffering, which almost completely hides the painting work

These work against you:
- PictureBoxes (PB is a stupid Control, I prefer to paint images myself, in a Paint handler)
- IIRC: transparancy in general, objects (e.g. Labels) on top of something transparant in particular

this normally helps:
- make the Form double-buffered by inserting this in its constructor:
SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer,true);
SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint,true);
SetStyle(System.Windows.Forms.ControlStyles.UserPaint,true);

(if such code is outside constructor it also needs a Control.UpdateStyles)
- avoid huge images, even when shown in small size (heavy rescale = CPU cycles); maybe calculate the right sized image once and keep it around.
- load the image from disk once (outside all Paint handlers) and keep it as an object.

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages

Local announcement (Antwerp region): Lange Wapper? Neen!


modified on Saturday, October 17, 2009 8:16 AM

GeneralRe: Form flickering problem Pin
SimpleData16-Oct-09 23:19
SimpleData16-Oct-09 23:19 
GeneralRe: Form flickering problem Pin
Luc Pattyn17-Oct-09 2:18
sitebuilderLuc Pattyn17-Oct-09 2:18 
GeneralRe: Form flickering problem Pin
Lyon Sun17-Oct-09 4:14
Lyon Sun17-Oct-09 4:14 
GeneralRe: Form flickering problem Pin
Luc Pattyn17-Oct-09 4:18
sitebuilderLuc Pattyn17-Oct-09 4:18 
GeneralRe: Form flickering problem Pin
Lyon Sun17-Oct-09 8:09
Lyon Sun17-Oct-09 8:09 
GeneralRe: Form flickering problem Pin
Luc Pattyn17-Oct-09 8:35
sitebuilderLuc Pattyn17-Oct-09 8:35 
GeneralRe: Form flickering problem Pin
Lyon Sun17-Oct-09 10:27
Lyon Sun17-Oct-09 10:27 
QuestionFill Collection With Excel Sheet Column Names Pin
Kevin Marois16-Oct-09 7:14
professionalKevin Marois16-Oct-09 7:14 
AnswerRe: Fill Collection With Excel Sheet Column Names Pin
dan!sh 16-Oct-09 7:32
professional dan!sh 16-Oct-09 7:32 
QuestionSerial Communication Pin
dwolver16-Oct-09 6:32
dwolver16-Oct-09 6:32 
AnswerRe: Serial Communication Pin
Luc Pattyn16-Oct-09 6:59
sitebuilderLuc Pattyn16-Oct-09 6:59 
GeneralRe: Serial Communication Pin
dwolver16-Oct-09 7:03
dwolver16-Oct-09 7:03 
GeneralRe: Serial Communication Pin
Luc Pattyn16-Oct-09 7:56
sitebuilderLuc Pattyn16-Oct-09 7:56 
GeneralRe: Serial Communication Pin
dybs16-Oct-09 18:44
dybs16-Oct-09 18:44 
QuestionHow to store words for a dictionary? Pin
Yednekachew16-Oct-09 6:30
Yednekachew16-Oct-09 6:30 
AnswerRe: How to store words for a dictionary? Pin
_Madmatt16-Oct-09 6:34
_Madmatt16-Oct-09 6:34 
AnswerRe: How to store words for a dictionary? Pin
Luc Pattyn16-Oct-09 6:46
sitebuilderLuc Pattyn16-Oct-09 6:46 

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.