编程语言
首页 > 编程语言> > C# winform 自绘控件 提供选择图片路径

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文件里

 

标签:控件,自绘,C#,Image,System,pictureBoxMain,typeof,Drawing
来源: https://www.cnblogs.com/tianheBologs/p/16538776.html