Board index » cppbuilder » Unpredictable Canvas->Polygon() results.

Unpredictable Canvas->Polygon() results.

Hello All,

I seem to be having a problem using the canvas' Polygon method.  When I call
it like:

Canvas->Polygon(clearBlock, 4);

Where clearBlock is an array of 4 points consisting of:
{ { 652, 5 }, { 752, 5 }, { 752, 129 }, { 652, 129 } }

These points definitely form a square, but I get weird and unpredictable
output from polygon.  Changing the order of the points
seems to give me different albeit similarly dissatisfying results.  So I
guess the order matters, but what order is supposed to be used?

Thanks,

-Mike

 

Re:Unpredictable Canvas->Polygon() results.


Hi Michael,

Quote
> I seem to be having a problem using the canvas' Polygon method.  
> When I call it like:

> Canvas->Polygon(clearBlock, 4);

> Where clearBlock is an array of 4 points consisting of:
> { { 652, 5 }, { 752, 5 }, { 752, 129 }, { 652, 129 } }

The second (last) parameter to the Polygon() member function should be
the zero-based index of the last point in your array (i.e., it should
specify one less than the total number of point in the clearBlock
array).  Try passing 3 instead of 4.

Best of luck,

--
Damon Chandler (TeamB - C++Builder)
- http://homepages.go.com/~damonchandler/vcl_faq.zip
- http://bcbcaq.freeservers.com

Re:Unpredictable Canvas->Polygon() results.


Hello Michael,
"Michael A. Powers" <mapow...@email.com> schreef in bericht
news:930rcu$iqj1@bornews.inprise.com...

Quote
> Hello All,

> I seem to be having a problem using the canvas' Polygon method.  When I
call
> it like:

> Canvas->Polygon(clearBlock, 4);

If you look up the example in the online help of TCanvas::Polygon() you'll
see the above line expects five points in the clearBlock array.

Type: Canvas->Polygon( clearBlock, 3 );

and it should work...;-))

Quote
> -Mike

--
Greetings from rainy Amsterdam

         Jan

email: bijs...@worldonline.nl
http://home.worldonline.nl/~bijster

Other Threads