Sign in to follow this  
knos991

GDI - how to get RECT from HRGN region

Recommended Posts

I'm new to GDI and I'm trying to figure out how to get a RECT object (with bottom,left,top,right coordinates in logical units) from a HRGN handle of the clipping region.

 

Is there a way to do this or am I getting something wrong in how to use them? 

Share this post


Link to post
Share on other sites

To answer your question directly: unfortunately, you can't. sad.png

 

FYI: RECT is not a GDI object, it's just a structure. HRGN is a GDI object, like pens and brushes.. In addition, a region can be more than a rectangle - it can be elliptical, a polygon and even combined with other regions with logical operators such as RGN_OR, RGN_AND, etc., to form a COMPLEXREGION.

Edited by Buckeye

Share this post


Link to post
Share on other sites

Thanks to both of you! Very much appreciated smile.png

 

Unfortunately this stuff is very poor documented, I should get a copy of Petzold's book I suppose. Thanks!

Share this post


Link to post
Share on other sites

I should get a copy of Petzold's book I suppose.

 

Well.. I didn't find GetRgnBox in the 5th edition.  huh.png  But it's in the MS Help for Visual Studio, bigger than life. Thumbs up to mark ds for finding that.

 

EDIT: Having said that, it's an excellent book for the Windows API. It is not an encyclopedia for the API, but there are good compile-first-time examples for beginner-to-intermediate level.

Edited by Buckeye

Share this post


Link to post
Share on other sites

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