Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

Get Invalid Regions

 How can I get hold of the invalid region of a component. They seem to validate the region before I get a chance to check it. I've tried calling GetUpdateRgn in a components paint method (before inherited is executed), but the region I get seems to be empty.
  When can I get hold of the Update Region for a component?
0
StevenB
Asked:
StevenB
  • 4
  • 3
1 Solution
 
gysbert1Commented:
Have a look at WM_NCPAINT

It has the parameter : hrgn = (HRGN) wParam;

From the windows API help:
  An application can intercept this message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

Remember that if the repaint is needed for a very small region windows may do it without sending you the message. This happens eg. when pulldown menus obscure a window or icons are dragged over them. In these cases no invalid regions are created and windows stores a small bitmap of the window over which you have no control.
0
 
StevenBAuthor Commented:
 Sorry that I've not responded to this answer yet. I'm not ignoring it, it's just that I'm very busy with something else currently. I'll respond properly on Monday, when I've had proper time to investigate.

  Thanks for your patience,
    Steven.
0
 
gysbert1Commented:
I wish more people would be as nice as to let one know. Some of my answers are pending for more than two months now without any reply !
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
gysbert1Commented:
I wish more people would be as nice as to let one know. Some of my answers are pending for more than two months now without any reply !

Don't bother sendign a message in reply to this. I'll wait till monday ;^)
0
 
StevenBAuthor Commented:
 I know this is a little outside the scope of the original question, but what do you know about how non-windowed controls broadcast paint instructions? The components I'm using are non-windowed controls and the advice you've given above works fine when, for example, a form, or seperate window is dragged over my controls, but when they are dragged over each other they do not seem to trigger the code I've written.
0
 
gysbert1Commented:
All controls must be within a windowed control. The window that hosts the controls receives all the messages that cause the window to repaint. As far as I know everything that is non-windowd within a window is handled just like it is graphics and has to be redrawn by the window containing it if it is overwritten. Thus the window hosting your control should receive the messages ...

If it doesn't I am clueless ;)
0
 
StevenBAuthor Commented:
 Yes, I've been relaying the invalid region from the parent windowed control down to the non-windowed components, using the event you suggested, its just that the event, unsurprisingly, isn't triggered by simply dragging the non-windowed components about on their parent. I suspect that I'm going to have to do my own internal invalidation routines for non-windowed controls.

  Cheers for the advice, Steven.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now