想做一个控件,在button的右上角;左上角;中间各有一个字符串对应text1,text2,text3属性,求高人解答,先行谢过

解决方案 »

  1.   

    button.Control.Add(TextBox) 这样添加  需要设置Anchor
      

  2.   

    做一个简单的自定义控件,其实就是复合 控件,一个button上放3个lable.lable的 text对应 text1,text2,text3属性
      

  3.   

     public partial class XButton : Button    {
            public XButton()
            {
                InitializeComponent();
            }        protected override void OnPaint(PaintEventArgs pevent)        {
                base.OnPaint(pevent);
                pevent.Graphics.DrawString("hello", new Font("", 12, FontStyle.Bold), Brushes.Black, new PointF(pevent.ClipRectangle.Left, pevent.ClipRectangle.Top));
                pevent.Graphics.DrawString("world", new Font("", 12, FontStyle.Bold), Brushes.Black, new PointF(pevent.ClipRectangle.Left, pevent.ClipRectangle.Bottom-30));
                pevent.Graphics.DrawString("haha", new Font("", 12, FontStyle.Bold), Brushes.Black, new PointF(pevent.ClipRectangle.Right-80, pevent.ClipRectangle.Top));
                pevent.Graphics.DrawString("thankyou", new Font("", 12, FontStyle.Bold), Brushes.Black, new PointF(pevent.ClipRectangle.Right-80, pevent.ClipRectangle.Bottom - 30));        }
        }