如何实现随MOUSE移动自动显示/隐藏某控件?

winhelp 2001-06-19 10:44:00
如何实现随MOUSE移动自动显示/隐藏某控件?

编一个程序,要求实现当MOUSE移至一个控件如TEdit上时,显示出被隐藏的另一个控件如TCheckBoxList,这时MOUSE可以移至TCheckBoxList上进行操作,但当MOUSE移出TCheckBoxList时,要求TCheckBoxList被隐藏。
也许还要求在当TCheckBoxList被显示时,MOUSE从TEdit移动至TCheckBoxList时,即被显示时,MOUSE从TEdit移出时,TCheckBoxList不能被隐藏。
...全文
66 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xycleo 2001-06-19
  • 打赏
  • 举报
回复
bool Visual=1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Label1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
Visual=1;
CheckBox1->Visible=true;
}
//---------------------------------------------------------------------------


void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if(Visual==0)
CheckBox1->Visible=false;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::CheckBox1MouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
Visual=0;
}
xycleo 2001-06-19
  • 打赏
  • 举报
回复
用一个全局变量Visual来判断!!!!
我不懂电脑 2001-06-19
  • 打赏
  • 举报
回复
读取窗体坐标,用坐标判断也可以
wjzhuang 2001-06-19
  • 打赏
  • 举报
回复
在MouseMove事件理判断当前的控件-----利用Sender参数和控件的Visbile属性可实现

13,825

社区成员

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

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