PictureEditEx

public class PictureEditEx : PictureEdit
    {
        public PictureEditEx()
        {
            this.SetStyle(ControlStyles.Selectable, false);
        }

        private ImageTextControl[] ListButton = new ImageTextControl[] { };

        public ImageTextControl[] Buttons
        {
            get { return this.ListButton; }
            set
            {
                this.ListButton = value;
                //Invalidate();
                foreach (ImageTextControl ctr in ListButton)
                {
                    
                    this.Controls.Add(ctr);
                }
            }
        }
        
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            //if (ListButton.Length > 0)
            //{
            //    foreach (Button mbtn in ListButton)
            //    {
            //        ControlPaint.DrawButton(e.Graphics, new Rectangle(mbtn.Location, mbtn.Size), ButtonState.Normal);
            //    }
            //}
        }

        private ImageTextControlCollection mlist = null;
        protected override Control.ControlCollection CreateControlsInstance()
        {
            //return base.CreateControlsInstance();
            if (mlist == null)
                mlist = new ImageTextControlCollection(this);
            return mlist;
        }

    }

Supongo que te gusta

Origin blog.csdn.net/fuweiping/article/details/42712689
Recomendado
Clasificación