29037453
.net技术群,欢迎加入~~~

解决方案 »

  1.   

    public partial class SingleLine : Label
        {
            public SingleLine()
            {
                InitializeComponent();
                this.Text = drawing();
            }
            private string _image;
            public string Image
            {
                set
                {
                    this._image = value;
                }
            }
            private string drawing()
            {
                string txt="";
                for (int i = 0; i < this.Size.Width/2;i++ )
                {
                    txt += "-" + _image;
                }
            }
        }
      

  2.   

    所有操作尽在Graphics类中,例如:public void DrawLinePoint(PaintEventArgs e)
    {    // Create pen.
        Pen blackPen = new Pen(Color.Black, 3);    // Create points that define line.
        Point point1 = new Point(100, 100);
        Point point2 = new Point(500, 100);    // Draw line to screen.
        e.Graphics.DrawLine(blackPen, point1, point2);
    }在一个空白窗体的paint事件中调用该函数即可。
      

  3.   

    如果不用GDI编程的话,那只能使用控件了,GroupBox压得很细的话效果是一根线。
    你可以在Lable上画,然后设置一下背景颜色做一种假像。