canvas->polygon()

muzhi 2003-02-14 01:54:08
程序如处:
POINT vertices[3];
vertices[0]=Point(0,0);
vertices[1]=Point(0,ClientHeight);
vertices[2]=Point(ClientWidth,ClientHeight);
Canvas->Polygon(vertices,2);

错误提示:
[C++ Error] Unit1.cpp(42): E2034 Cannot convert 'tagPOINT *' to 'const TPoint *'
[C++ Error] Unit1.cpp(42): E2342 Type mismatch in parameter 'Points' (wanted 'const TPoint *', got 'tagPOINT *')
...全文
109 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hdaq 2003-02-15
  • 打赏
  • 举报
回复
未定义PenColor、PenWidth、PenSize这三个元件。
你是从哪里拷来的程序吧,别忘了把元件也要一起拷过来啊
muzhi 2003-02-15
  • 打赏
  • 举报
回复
有人答吗?
muzhi 2003-02-14
  • 打赏
  • 举报
回复
另一问:
void __fastcall TForm1::PenColorClick(Tobject *Sender)
{
Canvas->Pen->Color=PenColor->ForegroundColor;
}

void __fastcall TForm1::Button2Click(TObject *Sender)
{
Canvas->Pen->Width=PenWidth->Position;
PenSize->Caption=IntToStr(PenWidth->Position);
}
错误:
[C++ Error] Unit1.cpp(49): E2451 Undefined symbol 'PenColor'
[C++ Error] Unit1.cpp(55): E2451 Undefined symbol 'PenWidth'
[C++ Error] Unit1.cpp(56): E2451 Undefined symbol 'PenSize'
hdaq 2003-02-14
  • 打赏
  • 举报
回复
This example draws a polygon in the specified shape, and fills it with the color teal. Add a paint box component to the form, and assign the following as its OnPaint event handler:

void __fastcall TForm1::PaintBox1Paint(TObject *Sender)

{
Windows::TPoint 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);

}

551

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 茶馆
社区管理员
  • 茶馆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧