Click here to Skip to main content
15,886,783 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to create a special form,covered by a bitmap absolutely.In my view ,the form consists of a lot of points,but ,according to the function ExtCreateRgn,a form is made up of more rectangle.Oh,How can I deal with it?
Posted
Comments
enhzflep 4-Jun-14 9:50am    
Do you care to further elaborate on where you're stuck?
When it comes to screen coordinates, a 'point' refers to a single pixel - that is, a rectangle whose right and bottom coord are left+1 and top+1.

So, lets assume you wish to have a 5 pixel region that resembles an X. Lets also assume that the top,left of the region is at the origin (0,0)

■ = part of region
_ = blank (CP doesn't show the diagram properly if I use the space character ' ')

■_■
_■_
■_■

You'd need 5 RECTs, each with an area of just 1 pixel.
r0(left,top,right,bottom) = 0,0, 1,1
r1(left,top,right,bottom) = 2,0, 3,1
r2(left,top,right,bottom) = 1,1, 2,2
r3(left,top,right,bottom) = 0,2, 1,3
r4(left,top,right,bottom) = 2,2, 3,3
codeprojectddx 4-Jun-14 10:20am    
thank you ,then How to use the function ExtCreateRgn,second element of the struct RGADATA ,char [1] that I do not understand what it means .
enhzflep 4-Jun-14 10:54am    
You're welcome. Me either to be honest.
These links may help (I just searched for "ExtCreateRegion sample")

http://edais.mvps.org/Tutorials/GDI/DC/DCch6.html
http://forums.codeguru.com/showthread.php?26046-Nightmare-on-ExtCreateRegion()-street

Note particularly the answer to the question in the 2nd link. :)

1 solution

Here is the best article about regions and how to deal with them: Guide to WIN32 Regions
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900