Board index » cppbuilder » Problems transferring a Polygon to Canvas

Problems transferring a Polygon to Canvas

I am updating a graphics program which copys a Polygon to the Canvas.
Basically the code is:

POINTS LeftArrow[7];
points[0] = Point(10,10);
points[1] ...
Canvas->Polygon(LeftArrow,6);

Now the previous Programmer compiles his program in C++ Builder 3 and it
worked fine. I am using C++ Builder 4 and I am getting the following
error:

[C++ Error] CDI.cpp(108): E2034 Cannot convert 'tagPOINT *' to 'const
TPoint *'.
[C++ Error] CDI.cpp(108): E2343 Type mismatch in parameter 'Points' in
call to '_fastcall TCanvas::Polygon(const TPoint *,const int)'.

I though this might be my alteration but I couldn't see where, so I tried
Borland's example in their help file with a fresh form ie:

This example draws a polygon in the specified shape, and fills it with
the color teal:

void __fastcall TForm1::PaintBox1Paint(TObject *Sender)

{
  POINT points[4];
  points[0] = Point(10,10);
  points[1] = Point(30,10);
  points[2] = Point(130,30);
  points[3] = Point(240,120);
  ((TPaintBox *)Sender)->Canvas->Brush->Color = clTeal;
  ((TPaintBox *)Sender)->Canvas->Polygon(points, 3);

Quote
}

But I get exactly the same error message, has anyone else had this
problem with Builder 4. Is this regarded as a bug considering their own
example doesn't work???

Zane

 

Re:Problems transferring a Polygon to Canvas


On Sun, 24 Oct 1999 19:03:36 +0100, cahil...@cs.man.ac.uk (Zane

Quote
Cahill) wrote:
>POINTS LeftArrow[7];
>points[0] = Point(10,10);
>points[1] ...
>Canvas->Polygon(LeftArrow,6);

Hi Zane,

    try to use TPoint instead ...

TPoint LeftArrow[7];
LeftArrow[0] = Point(10,10);
LeftArrow[1] ...
....

HTH

Regards

Giuliano

Re:Problems transferring a Polygon to Canvas


You may need to use TPOINTS.
Quote
Zane Cahill wrote:
> I am updating a graphics program which copys a Polygon to the Canvas.
> Basically the code is:

> POINTS LeftArrow[7];
> points[0] = Point(10,10);
> points[1] ...
> Canvas->Polygon(LeftArrow,6);

> Now the previous Programmer compiles his program in C++ Builder 3 and it
> worked fine. I am using C++ Builder 4 and I am getting the following
> error:

> [C++ Error] CDI.cpp(108): E2034 Cannot convert 'tagPOINT *' to 'const
> TPoint *'.
> [C++ Error] CDI.cpp(108): E2343 Type mismatch in parameter 'Points' in
> call to '_fastcall TCanvas::Polygon(const TPoint *,const int)'.

> I though this might be my alteration but I couldn't see where, so I tried
> Borland's example in their help file with a fresh form ie:

> This example draws a polygon in the specified shape, and fills it with
> the color teal:

> void __fastcall TForm1::PaintBox1Paint(TObject *Sender)

> {
>   POINT points[4];
>   points[0] = Point(10,10);
>   points[1] = Point(30,10);
>   points[2] = Point(130,30);
>   points[3] = Point(240,120);
>   ((TPaintBox *)Sender)->Canvas->Brush->Color = clTeal;
>   ((TPaintBox *)Sender)->Canvas->Polygon(points, 3);

> }

> But I get exactly the same error message, has anyone else had this
> problem with Builder 4. Is this regarded as a bug considering their own
> example doesn't work???

> Zane

Re:Problems transferring a Polygon to Canvas


I do also think that const_cast <Point*> (ThisPoint) must work!

Regards...

--
Frank Markus Schanzenb?cher
Programmer & Designer 4
visual and audial medias
Germany @  Individual Software GmbH
Mailto:Frank_Mar...@inso-gmbh.de

Check: http://signpro.iscool.net   for a Win32/CBuilder !Open Source!
Project

Zane Cahill schrieb in Nachricht ...

Quote
>I am updating a graphics program which copys a Polygon to the Canvas.
>Basically the code is:

>POINTS LeftArrow[7];
>points[0] = Point(10,10);
>points[1] ...
>Canvas->Polygon(LeftArrow,6);

>Now the previous Programmer compiles his program in C++ Builder 3 and it
>worked fine. I am using C++ Builder 4 and I am getting the following
>error:

>[C++ Error] CDI.cpp(108): E2034 Cannot convert 'tagPOINT *' to 'const
>TPoint *'.
>[C++ Error] CDI.cpp(108): E2343 Type mismatch in parameter 'Points' in
>call to '_fastcall TCanvas::Polygon(const TPoint *,const int)'.

>I though this might be my alteration but I couldn't see where, so I tried
>Borland's example in their help file with a fresh form ie:

>This example draws a polygon in the specified shape, and fills it with
>the color teal:

>void __fastcall TForm1::PaintBox1Paint(TObject *Sender)

>{
>  POINT points[4];
>  points[0] = Point(10,10);
>  points[1] = Point(30,10);
>  points[2] = Point(130,30);
>  points[3] = Point(240,120);
>  ((TPaintBox *)Sender)->Canvas->Brush->Color = clTeal;
>  ((TPaintBox *)Sender)->Canvas->Polygon(points, 3);

>}

>But I get exactly the same error message, has anyone else had this
>problem with Builder 4. Is this regarded as a bug considering their own
>example doesn't work???

>Zane

Other Threads