foreach(Control item in this.controls)
{
if(item.name=="ImageList1")
userControl.image=(ImageList)item
}
{
if(item.name=="ImageList1")
userControl.image=(ImageList)item
}
解决方案 »
- 数据库的format语句
- 急!!!运行command.ExecuteNonQuery()时‘(’有语法错误,请指教
- 请问C#能否在客户端直接输出数据库中的提示信息!
- C#动态加载程序库的问题
- .net中进行AUTOCAD二次开发,如何新增菜单?
- 请问C#如何实现点击窗体的关闭按钮时窗体不关闭啊
- 关于remoting的singleton模式,有个问题想不通?
- 再发一帖问问C# listview 的问题
- 菜鸟问题:如何编写一个不用声明的类或者函数?
- 刚装上了CS2.1并升级到了ASP.NET2.0, 出现一个"正在中止线程"的错误???
- 请高手指教,怎样在窗口里输出文字?
- 看这个update语句有错吗?
foreach(Control item in this.controls)
{
if(item.GetType==(new ImageList()).GetType())
//...
}
Cannot convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.ImageList'呵呵!
public ImageList Image
{
set
{
_image=value;
}
get
{
return _image;
}
}
{
get
{
foreach(ImageList item in this.Parent.Controls)
{
if(item!=null)
imageList=item;
}
imageList;
}
}
我改写了,不过总觉得似乎有问题…………
{
private ImageList _imageList;
public MyImageList
{
set { _imageList = value;} //你也可以在这里写其他的处理
get { return _imageList;}
}
}使用的时候,
MyControl c = new MyControl();
c.MyImageList = this.imageList1; //this是指Form
原来这么简单,我把它想的太复杂了。
谢谢各位的回答!
准备结贴!