对话框对父窗体的访问 不改private是肯定不能用你说的“this.Parent.控件名.控件属性名”的形式访问具体的方法是使用委托,即:子窗体声明一个委托事件;在父窗体生成子窗体之后,为这个委托添加响应处理函数;子窗体在需要操作父窗体控件的地方,引发该事件; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1. 把主窗口作为参数传入对话框就可以了。2. 在主窗口中增加internal或者public的函数来修改特定的控件的特定属性。3. 在对话框中调用public或者internal的函数。 例如:子窗体:public delegate void SetCtlText(string sss);public event SetCtlText = null;父窗体:FormChild cForm = new FormChild();cForm.SetCtlText += new FormChild.SetCtlText(PSetText);private void SetText( string xxx){this.button1.Text = xxx;} 子窗体在需要操作的地方写一个: public void MakeSetTextReady( string txt) { if(this.SetCtlText != null) { this.SetCtlText( "你的新字符串" ); } }另外纠正一下上面手误:第4行:public event SetCtlText OnSetCtlText= null;第7行:cForm.OnSetCtlText += new FormChild.SetCtlText(PSetText); 窗体间传值http://www.z6688.com/info/35370-1.htm ITextSharp 5.0以后 给pdf文件增加页码 大家在看下,付值的问题.. winform怎么演写复制,粘贴,剪切呢? 帮忙解一下两个textbox控件与button按钮和输出的问题 对VS2005自带的SQLServerExpress问题 [百分求救,顶者有分]我想确定一个关键字数组中每个关键字在一个长字符串中出现的位置(多个多次出现),请教,怎么实现最简单? 知道的进来,数据更新没反应 WebBrowser如何获取当前页面的html 怎样由web网页向 aspx提交申请? c#提示表和视图查询不到 .net安装出错问题!急!!! ActiveX 控件显示的问题
2. 在主窗口中增加internal或者public的函数来修改特定的控件的特定属性。
3. 在对话框中调用public或者internal的函数。
子窗体:
public delegate void SetCtlText(string sss);
public event SetCtlText = null;父窗体:
FormChild cForm = new FormChild();
cForm.SetCtlText += new FormChild.SetCtlText(PSetText);private void SetText( string xxx)
{
this.button1.Text = xxx;
}
{
if(this.SetCtlText != null)
{
this.SetCtlText( "你的新字符串" );
}
}另外纠正一下上面手误:
第4行:
public event SetCtlText OnSetCtlText= null;第7行:
cForm.OnSetCtlText += new FormChild.SetCtlText(PSetText);
http://www.z6688.com/info/35370-1.htm