在C#2005中,我新建了一个MDI工程,同时新建了另一个Control Library的工程,生成的UserControl的DLL,插入到MDI子窗体中,现在我通过主窗体访问控件中的公共方法没有问题;
但是在UserControl的DLL中,我想同样去访问MDI主窗体的实例,可惜没有想到一个好的办法!哪位大侠有做过这样的或是有好的主意,不仿提点一二,在此先谢了!
但是在UserControl的DLL中,我想同样去访问MDI主窗体的实例,可惜没有想到一个好的办法!哪位大侠有做过这样的或是有好的主意,不仿提点一二,在此先谢了!
public delegate void Test( string Value );
publie yourControl
{
private Test myTest = null;
//Init it in constructor or property
//you can call it as :myTest( "test" );
}//in your form
private void myFormTest( string Value )
{
Debug.WriteLine( Value );
}
//use "myFormTest" to init usercontrol's myTest member as : new Test( myFormTest )
public Windows.Form fm;
在程序启动的时候,对其付值不就行了么