Board index » cppbuilder » Create Round Edges in form, a Bug..... ?

Create Round Edges in form, a Bug..... ?


2004-06-02 02:03:36 AM
cppbuilder74
Hi all,
I'm trying as part of my application to create form with round
edges, for doing that i'm using the folowing method, i post
here only part of the full code -
TPoint P[30];
int i = 0;
// Upper left Corner
// = = = = = = = = = =
P[i].x = 0;
P[i++].y = 5;
P[i].x = 1;
P[i++].y = 4;
P[i].x = 1;
P[i++].y = 3;
P[i].x = 2;
P[i++].y = 2;
P[i].x = 3;
P[i++].y = 1;
P[i].x = 4;
P[i++].y = 1;
P[i].x = 5;
P[i++].y = 0;
.
.
.
.
.
// Lower left Corner
// = = = = = = = = = =
P[i].x = 5;
P[i++].y = Height - 0;
P[i].x = 0;
P[i++].y = Height - 5;
SetWindowRgn( Handle, CreatePolygonRgn( P, i, WINDING ), true );
-- -- -- -- -- -- --
The problem is that it seems like the line that i'm trying to
draw for the corners in not going exactly as the X & Y positions
that i set in the 'P[]' array, i checked it in the windows paint
under the largest zooming that let me see every pixel and pixel,
and as i checked it i saw some points that where different from
the positions that i set in the array, for example if i set -
P[7].x = 5;
P[7].y = 8;
P[8].x = 7;
P[8].y = 12;
then when i'm looking under windows paint i see that the line
was actually drawn between the spots -
( 5, 8 ) - ( 7, 11 ); // This is wrong it should be 12 not 11!!
I didn't check this exactly numbers, it was only an example that
i hope that will let you understand what i'm talking about.
So, how can it be? why does it happens? what should it do?
Thanks,
Ramy
 
 

Re:Create Round Edges in form, a Bug..... ?

"Ramy" < XXXX@XXXXX.COM >wrote in message
Quote
SetWindowRgn( Handle, CreatePolygonRgn( P, i, WINDING ), true );
If all you want is rounded edges, then use CreateRoundRectRgn() instead of
CreatePolygonRgn().
Gambit
 

Re:Create Round Edges in form, a Bug..... ?

I'll try it, thanks :-)
Quote
If all you want is rounded edges, then use CreateRoundRectRgn() instead of
CreatePolygonRgn().

Gambit
 

{smallsort}