Remove the line around the face of a button

  • Thread starter Thread starter Bruce Schechter
  • Start date Start date
B

Bruce Schechter

I am creating two buttons ("Forward" and "Back" in a windows forms
application that has a "browsing" function, vaguely like the forward/back
buttons in IE.) Using the VS.NET designer I placed images within each
button to visually show forward and reverse "arrows."



I have not been found a way to remove the edges of the buttons so that only
the images appear (without the surrounding box.) I've searched both the
VS.NET designer as well as all the methods/properties of the Button Class,
but found no way to control that attribute of the Button appearance.



How can this be done?



Thanks,

-- Bruce
 
Bruce,

Why dont you create a class that derives from button and overrides the
OnPaint method?

Picho
 
* "Bruce Schechter said:
I am creating two buttons ("Forward" and "Back" in a windows forms
application that has a "browsing" function, vaguely like the forward/back
buttons in IE.) Using the VS.NET designer I placed images within each
button to visually show forward and reverse "arrows."

I have not been found a way to remove the edges of the buttons so that only
the images appear (without the surrounding box.) I've searched both the
VS.NET designer as well as all the methods/properties of the Button Class,
but found no way to control that attribute of the Button appearance.

Place a toolbar control on the form, add two buttons to it and set its
'Appearance' property to 'Flat'.
 
In the toolbar buttons look flat without border.

But the toolbar itself draws a border at top even when broder is set to
NONE -

Any work arounds to get rid of that.

Mallik
 
Set the Divider property of the ToolBar to false:

[C#]
this.toolBar1.Divider = false;

[VB.Net]
Me.ToolBar1.Divider = False

.... these examples are given as code but you can easily change the Divider
property through the Properties grid.

--
Tim Wilson
..Net Compact Framework MVP

Mallikarjun Tuppad said:
In the toolbar buttons look flat without border.

But the toolbar itself draws a border at top even when broder is set to
NONE -

Any work arounds to get rid of that.

Mallik
 
Thanks for the recommendation. This approach is likely to work well for me.
However, I'm still new to C# and the WinForms technology... so would anyone
know of a good sample or article on how to do this?
Cheers, Bruce
 
Herfried,

Thanks for the response. I have never used the ToolBar control before. It
appears that the Toolbar must consume the entire real estate of one edge of
a window. In my case the two buttons would be the only controls on the
toolbar and thus would not be using the Form's real estate efficiently. Pls
let me know if I am not interpreting the situation correctly.

Meanwhile, my gut feel is that the recommendation previous to this one in
the this thread (to create a control that derives from Button and overrides
OnPaint) seems like a good solution for me... if I can find sample code or
a good article.

cheers, Bruce
 
When using the ToolBar set:
Appearance = Flat
AutoSize = False
Dock = None
Divider = False
then set the size and location.

--
Tim Wilson
..Net Compact Framework MVP

Bruce Schechter said:
Herfried,

Thanks for the response. I have never used the ToolBar control before. It
appears that the Toolbar must consume the entire real estate of one edge of
a window. In my case the two buttons would be the only controls on the
toolbar and thus would not be using the Form's real estate efficiently. Pls
let me know if I am not interpreting the situation correctly.

Meanwhile, my gut feel is that the recommendation previous to this one in
the this thread (to create a control that derives from Button and overrides
OnPaint) seems like a good solution for me... if I can find sample code or
a good article.

cheers, Bruce
 
* "Mallikarjun Tuppad said:
In the toolbar buttons look flat without border.

But the toolbar itself draws a border at top even when broder is set to
NONE -

Set 'Dock' to 'None', 'Anchor' to 'None' and 'Divider' to 'False'.
 
Back
Top