请各位高人指点迷津

hzx518 2006-12-08 09:20:21
请各位高人帮我看一下此段代码是否正确?我本意是想做一组按钮,当鼠标移动到其中一个按钮,该按钮变为黄色,并且按钮上凸起,但一直未达到目的。(该代码去掉了变色的部分)
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
for (int I = 0; I < 5; I++)
{
TPanel * vPanel = new TPanel(this);
vPanel->Parent = this;
vPanel->Tag = I;
vPanel->Top = I * 45;
vPanel->BevelInner = bvNone;
vPanel->BevelOuter = bvNone;
vPanel->Width = 60;
vPanel->Height = 25;
vPanel->Caption = I;

TSpeedButton *vSpeedButton = new TSpeedButton(this);
vSpeedButton->Parent = vPanel;
vSpeedButton->Flat = true;
vSpeedButton->Tag = I;
vSpeedButton->Top = I * 45;
vSpeedButton->Width = vPanel->Width;
vSpeedButton->Height = vPanel->Height;
vSpeedButton->Caption = String("B") + (I+1);
vSpeedButton->OnMouseMove = PanelMouseMove;
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::PanelMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
TVarRec v[] = {X, Y};
((TPanel *)Sender)->Hint = Format("X: %d, Y : %d", v, ARRAYSIZE(v) - 1);
((TPanel *)Sender)->ShowHint = true;
}
...全文
76 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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