Please click this logo to help me get on their beta program:

Xobni outlook add-in for your inbox








7/12/2006

Custom handling of the non-client area

Filed under: General, Programming, .NET — Oliver Sturm @ 11:58 am - 1 year, 10 months ago

I recently saw a post in an MS newsgroup and as I had an example that I wrote earlier, I just thought I’d make it available. What this does is simple: it implements custom handling of the non-client area of a window. The non-client area is, normally, the area of a window that is not part of the client area (duh!), like that used for adornments, window buttons, borders, that kind of thing.

While the user moves the mouse over a window’s area, Windows sends messages to figure out which part of the window is currently underneath the mouse cursor, and if it finds certain areas, it handles the corresponding functionality itself. By overriding the default behaviour and returning the right values for these messages, it’s therefore easy to have Windows activate the resize behaviour of the right border, for instance, although the mouse cursor is actually not over the right border at that moment (or even if there isn’t any right border at all).

My sample program draws some rects on its client area that “pose” as the borders of the window, as well as the title bar and the resize rect in the lower right hand corner. Looks like this:

CustomNCHandling

Here’s the download, which includes source code as well as a compiled version of the application, in case you just want to try it quickly.

CustomNCHandling.zip (15 KB)

1 Comment »

  1. This was very helpful.
    Thank you.

    Comment by Carlos Simões — 29/3/2007 @ 2:37 pm - 1 year, 6 months ago

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Powered by WordPress
© Copyright 2005-2008 Oliver Sturm