winfrom 自定义控件属性设定

自定义设置属性窗口:

 public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        public Image PicImage { get => pictureBox1.Image; set => pictureBox1.Image = value; }

        public string  LabelMsg { get => label1.Text; set => label1.Text = value; }
    }

样式:

 调用加载需要按下Shift+Ctrl+B到工具箱。

这样在主窗体调用就会显示出属性界面:

本文来自博客园,作者:云辰,转载请注明原文链接:https://www.cnblogs.com/yunchen/p/13903134.html

原文地址:https://www.cnblogs.com/yunchen/p/13903134.html