Sign in to follow this  

Render the WHOLE control

This topic is 4576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! Are there any ways to force a control to fully render itself even though it's hidden or partially covered (Win32 API or C#)? -Pim

Share this post


Link to post
Share on other sites
Quote:
Original post by pim
Are there any ways to force a control to fully render itself even though it's hidden or partially covered (Win32 API or C#)?

For MFC controls ::Invalidate() does the trick. For plain win32 API you might use ::InvalidateRect() with NULL as rectangle pointer.

(there's also ::RedrawWindow() which works in similar manner but allows more control over the whole thing...)

Share this post


Link to post
Share on other sites
Are you sure this will repaint the control even if it's not visible or if it's partially covered? What I want to do, is render a hidden control to a custom device context so that I can save the whole image...

Share this post


Link to post
Share on other sites
Hmm did a quick check and looks like no, the control is not guaranteed to get the WM_PAINT message if it's hidden (it does work for partially covered controls) You can give it explicit WM_PAINT call with ::SendMessage() though and this does get delivered.

Share this post


Link to post
Share on other sites
Well, only one way to find out ;s

since you have access to DC --and consequently the control's clipping region-- in the paint routine for the control, you should be able to override it there if necessary... that's presuming a more straightforward approach like call to ::InvalidateRect() / ::InvalidateRgn() gets intercepted for hidden control.

Share this post


Link to post
Share on other sites
if you need to circumvent windows regular drawing loop then you can always call paint directly just make sure to call begin paint endpaint, or use a CPaintDC to draw into. If you want an image then you can creatte a CPaintDC set a bmp into it, draw into the dc, then get a bmp out of it.

CHeers
Chris

Share this post


Link to post
Share on other sites
Thanks for the replies... I don't have the code I was working on at hand for some time (I'm not at that computer), so I suppose I'll get back to it!

Share this post


Link to post
Share on other sites

This topic is 4576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this