Show(), hide(),知道的帮帮忙

Uron 2013-12-02 04:23:43
5行代码,实现Form2能够下次显示的时候,界面莫非选中的是RadioButton1。求大神给力!

Form1.cpp内容如下:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
this->Hide();
Form2->Show();
}

Form2.cpp内容如下:
void __fastcall TForm2::RadioButton2Click(TObject *Sender)
{
this->Hide();
RadioButton1->Checked = true;
Form1->Show();
}
...全文
191 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
宝龙哥 2013-12-03
  • 打赏
  • 举报
回复
引用 8 楼 cs290473786 的回复:
[quote=引用 6 楼 kfrght 的回复:] 如果RadioButton2获得焦点,那么RadioButton1将被选中
Form2上单击RadioButton2的时候,Form2隐藏显示Form1,下次Form2显示的时候默认选中的是RadioButton1。[/quote] 你这个是要问什么呢?
Uron 2013-12-03
  • 打赏
  • 举报
回复
引用 6 楼 kfrght 的回复:
如果RadioButton2获得焦点,那么RadioButton1将被选中
Form2上单击RadioButton2的时候,Form2隐藏显示Form1,下次Form2显示的时候默认选中的是RadioButton1。
Uron 2013-12-03
  • 打赏
  • 举报
回复
引用 4 楼 ccrun 的回复:
"界面莫非选中的是RadioButton1" 没明白楼主的意思, 难道是想说: 默认选中的是RadioButton1?
默认,呵呵。
宝龙哥 2013-12-02
  • 打赏
  • 举报
回复
如果RadioButton2获得焦点,那么RadioButton1将被选中
宝龙哥 2013-12-02
  • 打赏
  • 举报
回复
这是什么情况
ccrun.com 2013-12-02
  • 打赏
  • 举报
回复
"界面莫非选中的是RadioButton1" 没明白楼主的意思, 难道是想说: 默认选中的是RadioButton1?
Mr_Kaito 2013-12-02
  • 打赏
  • 举报
回复
这你的方式,建议在Form2关闭时加上主程序(Form1)中关闭。 否则Form2关闭时Form1中还在隐藏中并没有结束程序,

//Form1
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  this->Hide();
    Form2->Show();
}
//Form2
void __fastcall TForm2::RadioButton2Click(TObject *Sender)
{
   Form2 -> RadioButton1 -> Checked = true;
}
//------------------------------------------------------------
void __fastcall TForm2::RadioButton2MouseUp(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
    this->Hide();
    Form1->Show();
}
//--------------------------------------------------------------
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
    Form1->Close();
}
Mr_Kaito 2013-12-02
  • 打赏
  • 举报
回复
这我的方式,我还没发现到写在一起会有错误呢..这是时机的问题!
//From1
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 Form2->Visible = true;
 Form1->Visible = false;
}
//From2
//--------------------------------------------------------
void __fastcall TForm2::RadioButton2Click(TObject *Sender)
{
   Form2 -> RadioButton1 -> Checked = true;
}
//----------------------------------------------------------
void __fastcall TForm2::RadioButton2MouseUp(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
  Form1->Visible = true;
   Form2->Visible = false;

}
Uron 2013-12-02
  • 打赏
  • 举报
回复
,如图。

604

社区成员

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

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