C# winform 自绘控件 提供选择图片路径

参考原文https://www.thinbug.com/q/27898827

 

 
//如以下代码,Image 属性将会 让你选择图片
1
[Description("Setting the image which shows main"), Category("Custom"), 2 DefaultValue(typeof(Image),"null"), 3 EditorAttribute(typeof(System.Drawing.Design.ImageEditor), 4 typeof(System.Drawing.Design.UITypeEditor))] 5 6 public Image MainImage 7 { 8 get { return pictureBoxMain.Image; } 9 set { pictureBoxMain.Image = value; } 10 }

//例如下图所示

 

而且选择后的图片会自动放到 使用该控件的 From 中的Resx文件里

 

posted on 2022-08-01 01:03  infinitable  阅读(451)  评论(0编辑  收藏  举报

导航