By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,660 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,660 IT Pros & Developers. It's quick & easy.

Slow form with multiple user controls redraw

P: n/a
Hello.
I'm working with WinForm. It has 30 same user control, each with 4 buttons,
3 labels, 3 textboxes, 2 picture boxes and uses override onPaint to draw
gradient rectangle. Main form also has 2 panels with same gradient.
I'm trying to reduce drawing speed on form activation. But at the moment it
is too noticeable for each user control to be drawn.
Tried to use double buffering on main form and on each user control, looks
almost the same.
Any help appreciated.
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Just in case, make sure that UserPaint and AllPaintingInWmPaint is true. DoubleBuffering requires these bits to be set.

You can attempt to cut down on the flicker and paint time by reducing the number of controls that you are using. You mentioned that
you are using 3 labels and 2 picture boxes. These can easily be represented through GDI without the use of a control. Less
messages in the message loop = faster response time. If you need hit detection for mouse events or other user-interaction with
these controls you'd have to implement that manually via the events of the container control, of course. Also, you'll lose
Form-based featuers that Controls provide such as docking, anchoring, tabbing, amoung others. The 2 panels can also be drawing (the
gradient) without the panels, but you'll lose Control containment that the Panel provides.

If you can reduce the number of controls you are using you will most surely notice a difference.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"conset23" <a@yahoo.com> wrote in message news:el*************@TK2MSFTNGP12.phx.gbl...
Hello.
I'm working with WinForm. It has 30 same user control, each with 4 buttons, 3 labels, 3 textboxes, 2 picture boxes and uses
override onPaint to draw gradient rectangle. Main form also has 2 panels with same gradient.
I'm trying to reduce drawing speed on form activation. But at the moment it is too noticeable for each user control to be drawn.
Tried to use double buffering on main form and on each user control, looks almost the same.
Any help appreciated.

Nov 17 '05 #2

P: n/a
And is there any other way except reducing controls number. UserPaint and
AllPaintingInWmPaint is true.

Maybe it is possible to draw all form at once, and deny drawing each user
control separately?
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.