P
Peter Duniho
The basic idea: I've got a form in which I draw a bitmap, scaled to fit
the form. For obvious reasons, I want to cache the scaled version of the
bitmap so that repainting the form is faster. I need to update the cache
any time the form size is changed. But I don't want to generate the
scaled bitmap every time I get the Resize event, because doing so makes
the resizing itself way too slow, even on a fast computer.
Ideally, I'm looking for an event that basically says "the form size has
changed and the user is done dragging". Alternatively would be some
convenient way to detect when the user starts and stops dragging the form.
The only solutions I've come up with so far are getting into the nuts and
bolts of the form's window, with the WndProc and the window messages
(probably have to be non-client, since I don't see anything obvious in the
basic WM messages that would work), or taking a completely different
approach to maintaining performance of the Resize event.
I'd prefer to avoid messing around with the WndProc, especially if there's
a better .NET Framework-approved way of dealing with the issue. In the
latter idea, all I can come up with is doing the bitmap caching in the
background on a different thread. That would work, and probably pretty
well too, but it seems overly complicated.
It seems like this would come up fairly often...what techniques are other
people using to deal with the problem?
Thanks!
Pete
the form. For obvious reasons, I want to cache the scaled version of the
bitmap so that repainting the form is faster. I need to update the cache
any time the form size is changed. But I don't want to generate the
scaled bitmap every time I get the Resize event, because doing so makes
the resizing itself way too slow, even on a fast computer.
Ideally, I'm looking for an event that basically says "the form size has
changed and the user is done dragging". Alternatively would be some
convenient way to detect when the user starts and stops dragging the form.
The only solutions I've come up with so far are getting into the nuts and
bolts of the form's window, with the WndProc and the window messages
(probably have to be non-client, since I don't see anything obvious in the
basic WM messages that would work), or taking a completely different
approach to maintaining performance of the Resize event.
I'd prefer to avoid messing around with the WndProc, especially if there's
a better .NET Framework-approved way of dealing with the issue. In the
latter idea, all I can come up with is doing the bitmap caching in the
background on a different thread. That would work, and probably pretty
well too, but it seems overly complicated.
It seems like this would come up fairly often...what techniques are other
people using to deal with the problem?
Thanks!
Pete