三角形,圆形按钮的创建

mazhichao84 2010-08-01 10:33:58
哪位高手帮帮忙,解决一下问题,谢谢
代码:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{//创建圆形
HRGN hRgnR=CreateEllipticRgn(0,0,Button1->Width,Button1->Height);
SetWindowRgn(Button1->Handle,hRgnR,TRUE);
// 创建三角形
TrPoint[0].x=Button2->Width/2;
TrPoint[0].y=0;
TrPoint[1].x=0;
TrPoint[1].y=Button2->Height;
TrPoint[2].x=Button2->Width;
TrPoint[2].y=Button2->Height;
HRGN hRgnT=CreatePolygonRgn(TrPoint,3,ALTERNATE);
SetWindowRgn(Button2->Handle,hRgnT,TRUE);
}
//---------------------------------------------------------------------------
错误提示:
Build
[C++ Error] Unit1.h(11): E2040 Declaration terminated incorrectly
[C++ Error] Unit1.cpp(22): E2451 Undefined symbol 'TrPoint'
...全文
91 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccrun.com 2010-08-01
  • 打赏
  • 举报
回复
定义一个TPoint数组:
TPoint TrPoint[3];


至于
Unit1.h(11): E2040 Declaration terminated incorrectly
这个错误,要看头文件中第11行到底是什么。
sue3140 2010-08-01
  • 打赏
  • 举报
回复
TrPoint 你没定义。。
至于头文件的错误嘛。。 没看着 所以无法评论 呵呵
ximenziplc 2010-08-01
  • 打赏
  • 举报
回复
把你的 Unit1.h 也帖出来,才能知道是什么问题
mazhichao84 2010-08-01
  • 打赏
  • 举报
回复
谢谢!!可以啦
那书上要求我定义在Unit1.h下面
犯了一个明显的常识错误

13,870

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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