在windows窗体程序中实现在form2中点击button1,关闭form2,并显示form1中button1 c#.net2005,windows窗体应用程序开发form2中的button1在窗体中直接拖放fotm1中的button1在窗体中直接拖放都是直接从工具箱拖的偶是新手,希望大虾详细些,用到属性什么的多写几个字!谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 form2中点击button1,关闭form2在button1的双击事件中写this.Close(); 在windows窗体程序中实现在form2中点击button1,关闭form2,并显示form1中button1 Form2中:button1_click(...){ this.Close();//关闭自己 Form1 frm=new Form1(); //准备一个Form1 frm.Button1.Visible=true; //显示form1中的button1 frm.Show();}Form1中:public Button Button1{ get{ return button1;}} phommy按照上面的方法,有点小问题,还请大虾们帮帮忙我的form1是主界面,上面程序执行后,又新建了个form1,结果出来就有两个了主界面上没实现功能,新的form1上实现了功能,能屏蔽主界面么?还是在程序中可以直接显示在主界面中? 照你的要求,Form2需要Form1的引用。Form1中增加:static Form1 Instance;Form1的Load事件中增加:Form1.Instance=this;Form2中:button1_click(...){ this.Close();//关闭自己 Form1 frm=Form1.Instance; //获得引用 if(frm==null) frm=new Form1(); frm.Button1.Visible=true; //显示form1中的button1 if(frm.Visible)frm.Show();} 最后一句写错,改成if(!frm.Visible)frm.Show(); 属于常见问题,参考这里,http://blog.csdn.net/zhzuo/archive/2004/04/05/22027.aspxhttp://blog.csdn.net/zhzuo/archive/2006/05/05/708941.aspx#sec5 C# FCKeditor 图片上传功能的安全性如何处理? 关于摘要 DataTable与原表数据类型一致的问题? 数据绑定横向滚动前10条记录 APS.NET连接数据库 请有经验的大哥,大姐给我一个思路 请问如何通过程序定时读取考勤打卡机里的打卡数据? 将二进制转为日期格式 哪位有网店的.net源码吗 请问,如何得到ArrayList中的某一个元素的值? 请高手举个简单的例子看看!急~~~ c#中是不是不能够对位进行操作?
在button1的双击事件中写
this.Close();
button1_click(...)
{
this.Close();//关闭自己
Form1 frm=new Form1(); //准备一个Form1
frm.Button1.Visible=true; //显示form1中的button1
frm.Show();
}Form1中:
public Button Button1{ get{ return button1;}}
static Form1 Instance;Form1的Load事件中增加:
Form1.Instance=this;Form2中:
button1_click(...)
{
this.Close();//关闭自己
Form1 frm=Form1.Instance; //获得引用
if(frm==null) frm=new Form1();
frm.Button1.Visible=true; //显示form1中的button1
if(frm.Visible)frm.Show();
}
if(!frm.Visible)frm.Show();
http://blog.csdn.net/zhzuo/archive/2004/04/05/22027.aspx
http://blog.csdn.net/zhzuo/archive/2006/05/05/708941.aspx#sec5