txwd0033的方法也可以啊! 但发现一个奇怪的问题, graphControl类中,Controls是NetronGraphControlCollection类型的属性public NetronGraphControlCollection Controls { get{return mControls;} }而NetronGraphControlCollection类又是如下定义的[Serializable] public class NetronGraphControlCollection : CollectionBase另外它还定义了一个Add方法如下:public int Add(NetronGraphControl control) { return this.InnerList.Add(control); }现在问题是,graphControl没有向ControlCollection继承,怎么能调用Add方法呢? 如果是用定义的Add方法,但TextBox又不是NetronGraphControl控件?再加50分……(不信搞不定你丫……)
你看哈,NetronGraphControl 的类型,
ScrollableControl的对象去add不就可以了 ?
lowtemper说的对,graphControl是从ScrollableControl类继承的public class GraphControl : ScrollableControl, IGraphSite, IGraphLayout(1)但我在MSDN上找不到ScrollableControl类的Add()方法,为什么可以用呢?(2)整个代码文件只搜到两段NetronGraphControl的语句如下: public int Add(NetronGraphControl control) { return this.InnerList.Add(control); }
public NetronGraphControl this[int index] { get{return this.InnerList[index] as NetronGraphControl;} } 提示,NetronGraph是所有内置控件的基类,大家帮我分析一下?
tx.Name = "tx";
tx.Location = new System.Drawing.Point(100, 100);
tx.Size = new System.Drawing.Size(20, 40);
this.Controls.Add(tx);
现在问题变为要在一个新容器控件graphControl(别人写的,不是windows自带的)上加TextBox控件。
试了一下,容器控件把TextBox遮住了。而容器控件从ScrollableControl类继承,没有定义新的加windows控件的方法。
再次请教各位大虾,又加了30分……
楼上大哥仗义出手,令小弟感激涕零,顿首再顿首……
各位都有分(莫怪太少,俺很穷),谢谢!呵呵:)
但发现一个奇怪的问题,
graphControl类中,Controls是NetronGraphControlCollection类型的属性public NetronGraphControlCollection Controls
{
get{return mControls;}
}而NetronGraphControlCollection类又是如下定义的[Serializable] public class NetronGraphControlCollection : CollectionBase另外它还定义了一个Add方法如下:public int Add(NetronGraphControl control)
{
return this.InnerList.Add(control);
}现在问题是,graphControl没有向ControlCollection继承,怎么能调用Add方法呢?
如果是用定义的Add方法,但TextBox又不是NetronGraphControl控件?再加50分……(不信搞不定你丫……)
public int Add(NetronGraphControl control)
{
return this.InnerList.Add(control);
}
public NetronGraphControl this[int index]
{
get{return this.InnerList[index] as NetronGraphControl;}
}
提示,NetronGraph是所有内置控件的基类,大家帮我分析一下?