4

I'm using VS 2010.

Is there a way to make a line separator in C# Windows Forms? I sometimes use default background color and total white background.

Both of this methods I found does not work for me.

        label2.AutoSize = false;
        label2.Height = 2;
        label2.BorderStyle = BorderStyle.Fixed3D;

or

        label2.MaximumSize = new Size(100, 0);
        label2.AutoSize = true;
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Ace Caserya
  • 2,825
  • 3
  • 25
  • 35
  • It's been marked duplicate but i wasn't able to find it at first glance, also the previous title does not specify something about line separator. – Ace Caserya Aug 09 '13 at 22:55

1 Answers1

3

Just change the first one to use BorderStyle.FixedSingle or change the height to at least 4.

There's not a lot that's new in WinForms, but VS should come with the Visual Basic Power Packs Controls. If you see that section in your toolbox, there's a line control available that you can drop on your designer. You can change its border style, thickness, color, etc.

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
  • Ok thanks. I just wish VB developers would invest on making a line object available on toolbox with prepared editable properties. – Ace Caserya Aug 06 '13 at 04:41