我电脑上面没有那个控件

解决方案 »

  1.   

    GDI
    Pen  p = new  Pen(Color.Blue, 5);
    Graphics  g = this.CreateGraphics();
    g.DrawLine(p, 10, 10, 200, 10);
      

  2.   

    没有那种控件,但可以用label实现,将其宽度设为1px,然后拖动调整其长度
      

  3.   

    用groupBox控件,把Text属性设成空,横线把高度设成2,竖线把宽度设成2
      

  4.   

     哥自己给你画了个控件,收下吧。
     
     public partial class LineControl : UserControl
        {
            private int _LineHeight = 1;
            /// <summary>
            /// 线高度
            /// </summary>
            public int LineHeight
            {
                get { return _LineHeight; }
                set 
                {
                    _LineHeight = value;
                    Height += value;
                    this.Invalidate();
                }
            }        private Color _LineColor = Color.Black;
            /// <summary>
            /// 前景色
            /// </summary>
            public override Color ForeColor
            {
                get
                {
                    return _LineColor;
                }
                set
                {
                    _LineColor = value;
                    this.Invalidate();
                }
            }               private Pen _linePen;
            private SolidBrush sb;        public LineControl()
            {
                this.AutoScaleMode = AutoScaleMode.None;
                this.BorderStyle = BorderStyle.None;
                this.Height = 1;
                InitializeComponent();
            }        protected override void OnPaint(PaintEventArgs e)
            {
                sb = new SolidBrush(_LineColor);
                _linePen = new Pen(sb, LineHeight);
                e.Graphics.DrawLine(_linePen,new Point(1,1),new Point(Width-1,1));
                base.OnPaint(e);
            }        protected override void OnResize(EventArgs e)
            {
                base.OnResize(e);
                this.Invalidate();
            }
        }
      

  5.   

    vs2010中的c#有画线的控件了。选择工具栏中的:
    Visual Basic Power Packs
    这里有个LineShape就是画线控件。其他版本就只有自己用代码画,或是用Label,Text设置为很多的__________,然后设置label的位置为底层,拖到别的控件下面,只漏出下划线来勉强凑合。当然,不能随便角度,这样控件没有,貌似有人写过。