Winform中Controls的Insert方法为什么不见了?
来源:互联网 发布:圣雄甘地 知乎 编辑:程序博客网 时间:2024/05/18 18:44
在Winform自定义的控件开发中,突然发现Controls集合没有一般IList所对应的Insert方法, 这是为什么呢?不是实现了IList中的方法么?
呵呵,不要忘记实现借口可以显示实现,这样ControlCollection类虽然实现了IList,但是影藏了Insert等方法,并且提供了SetChildIndex这个方法,MS希望如果需要调整Control在Controls里的位置,先Add这个Control,然后在用SetChildIndex这个方法调整,这是为什么呢?让我们反编译一个SetChildIndex这个方法,看看到底做了什么。
if (child == null)
{
throw new ArgumentNullException("child");
}
int childIndex = this.GetChildIndex(child);
if (childIndex != newIndex)
{
if ((newIndex >= this.Count) || (newIndex == -1))
{
newIndex = this.Count - 1;
}
base.MoveElement(child, childIndex, newIndex);
child.UpdateZOrder();
LayoutTransaction.DoLayout(this.owner, child, PropertyNames.ChildIndex);
}
- Winform中Controls的Insert方法为什么不见了?
- 20120904-VC++6.0环境中调出Controls工具箱的方法
- 解决eclipse中Android SDK和ADT不见了的方法
- XP桌面上的语言栏为什么不见了
- div之为什么你的图片不见了
- winForm开发--Controls
- rndc中controls的含义
- StringBuffer类中insert()方法的使用
- 窗体Controls的OfType<>方法的使用
- WinForm中刷新其他页面的方法
- winForm中导出Execl的方法
- C# Winform中绘制动画的方法
- C#WinForm中截取文件名的方法
- 在winform中绘制矩形的方法
- winForm中导出Execl的方法
- C# WinForm中进度条的实现方法
- Winform中打开网页页面的方法
- C# WINFORM中嵌入FLASH的方法
- POD对象
- linux下查看文件描述符信息
- 读书——影响力
- Jmail发送带有附件,正文如何使用HTML
- java设计模式之工厂方法模式
- Winform中Controls的Insert方法为什么不见了?
- Linux下通过修改网卡驱动的参数调整Intel网卡的性能
- 散列表(也叫哈希表),
- 关于Activesync 无法连接PPC 的解决过程及方法
- sql注入
- kernel module编程(二):一些古老的记忆
- 丢失tempdb无法启动SQL Server2005的故障排除
- Ajax入门
- SQLite3的数据类型