tags:

views:

246

answers:

6

Hi guys!

Situation: I need a tiny button, with some text on it.

Problem: The button seems to think displaying empty space near its edges is more important than displaying my Text.

I can't for the life of me figure out how to remove that blank stuff at the edges. Any help is greatly appreciated!

Thanks in advance.

-MonsterMaw

A: 

Another way of putting it. I want the Text on the button to fill the button completely.

+2  A: 

Assuming you're talking about WinForms, you can set the FlatStyle property of the button to System.

That will let you resize the button so that it is small enough for the text to fit exacty, without any internal padding.

RichieHindle
+1  A: 

You could override the OnPaint method on the button and then draw it however you like. I think you could use the base.OnPaint to draw the button without any text and then draw the text on yourself with pevent.Graphics.DrawString?

Filmund
+1  A: 

Consider whether this is desirable, though. Users expect some sort of standard behaviour from our applications, so if you're trying to bend the rules to make it non-standard, you should at least consider the fact it might not be the correct solution.

Other options include moving your UI commands to menus/toolbars and links, if buttons aren't doing it for you.

Neil Barnwell
+1  A: 

A LinkLabel is a good choice for this (assuming it fits your overall UI). It's just text, so you don't have to worry about borders or padding at all.

MusiGenesis
A: 

You could set the Text property of your Button to empty. Then place a label over the top of the button, if all else fails...

Edit. Don't forget to set your label's backcolor to transparent.

baeltazor