none
JSeparator in .NET Forms

    Question

  • Hi,
    Quick question.
    I was using Java a while ago and it had a component called "JSeparator". Is there something equivalent in .NET Forms?
    Thanx.
    • Edited by alexxz4 Friday, May 08, 2009 4:38 PM
    Friday, May 08, 2009 4:36 PM

Answers

  • The RectangleShape and LineShape components in the .NET 3.5 SP1 release lets you do something similar.  Experiment with the values of BorderStyle, BorderWidth, FillXxxx to get what you want.

    An trick that works with earlier versions is to use a GroupBox that's only a few pixels high.
    Hans Passant.
    • Marked as answer by Kira Qian Friday, May 15, 2009 5:35 AM
    Friday, May 08, 2009 4:55 PM
  • The equivalent to JSeparator is ToolStripSeparator: http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripseparator.aspx

    However, this is for menus/etc.

    If you want a separator/line in a panel or general component, and it's jsut for rendering, that's a different item (JSeparator was just for menus, etc, as well, in Java).

    The closest standard windows control is probably a Splitter.  This has behavor as well, though, since it allows you to resize the panels surrounding it.  If you just want to draw a line, the LineShape from the Visual Basic PowerPacks is a good option.
    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Kira Qian Friday, May 15, 2009 5:35 AM
    Friday, May 08, 2009 4:56 PM

All replies

  • The normal Windows Forms menu editors provide a way to add a separator.  They provide the same effect as the JSeparator derived classes.
    Reed Copsey, Jr. - http://reedcopsey.com
    Friday, May 08, 2009 4:43 PM
  • Im mostly hardcoding the forms.
    And I need to add a separator to a panel (or any other general components, not just menus).
    Friday, May 08, 2009 4:47 PM
  • The RectangleShape and LineShape components in the .NET 3.5 SP1 release lets you do something similar.  Experiment with the values of BorderStyle, BorderWidth, FillXxxx to get what you want.

    An trick that works with earlier versions is to use a GroupBox that's only a few pixels high.
    Hans Passant.
    • Marked as answer by Kira Qian Friday, May 15, 2009 5:35 AM
    Friday, May 08, 2009 4:55 PM
  • The equivalent to JSeparator is ToolStripSeparator: http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripseparator.aspx

    However, this is for menus/etc.

    If you want a separator/line in a panel or general component, and it's jsut for rendering, that's a different item (JSeparator was just for menus, etc, as well, in Java).

    The closest standard windows control is probably a Splitter.  This has behavor as well, though, since it allows you to resize the panels surrounding it.  If you just want to draw a line, the LineShape from the Visual Basic PowerPacks is a good option.
    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Kira Qian Friday, May 15, 2009 5:35 AM
    Friday, May 08, 2009 4:56 PM
  • Thanx, Ill simulate separator with another control.I thought there was a specific control with the functionality I want...

    Friday, May 08, 2009 5:01 PM