Resize Form and uninitialized memory

P

Peteroid

It looks like when I make a Form resizable and/or hit the maximize button
that it shows garbage (unitialized memory) for the new portions of the form
and then fills it in with background color. It only shows it very briefly,
but it's VERY visible during this time.

This happens with re-sizable forms too. And it 'feels' like re-sizing is
'jerky'; that is, lags a bit from my actions. I turn off visiblity to the
controls on the form while beginning re-sizing to help matters, and then
make them visible again when the re-sizing ends).

I've tried updating with and without using "Paint-only" (by way of
ControlStyles::AllPaintingInWmPaint). I also use the DoubleBuffered setting
(which I use for no Graphics drawing flicker).

For context, VS C++.NET 2005 Express using clr:/pure syntax.

[==P==]
 
W

William DePalo [MVP VC++ ]

Peteroid said:
It looks like when I make a Form resizable and/or hit the maximize button
that it shows garbage (unitialized memory) for the new portions of the
form and then fills it in with background color. It only shows it very
briefly, but it's VERY visible during this time.

What you are seeing is result of the low prioritization of the paint
message.

When you resize the form, a portion is marked "invalid", i.e. in need of a
paint job.

When higher priority messages (like the ones related to sizing and movement)
are removed from the queue, the invalid portions of the form ar repainted.

Try adding an OnResize() overload to your form's class and calling Refresh()
or Invalidate().

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top