Button.TextAlign bug?

H

Henrik

Hi,

I'm using C# and VS.net 2003. When adding a button to a
form using the designer, the default TextAlign value is
always set to MiddleCenter (which is fine). However, if I
change the font to be bold, the text is no longer center-
aligned, it is always a bit off to the right, more or
less depending on the string value. The TextAlign
property is still MiddleCenter though. Is this a known
bug?

Thanks,
Henrik
 
H

Herfried K. Wagner [MVP]

* "Henrik said:
I'm using C# and VS.net 2003. When adding a button to a
form using the designer, the default TextAlign value is
always set to MiddleCenter (which is fine). However, if I
change the font to be bold, the text is no longer center-
aligned, it is always a bit off to the right, more or
less depending on the string value. The TextAlign
property is still MiddleCenter though. Is this a known
bug?

I am able to repro that. Setting the button's 'FlatStyle' property to
'System' will help.
 
H

Henrik

Thanks, that helped. Now the only problem is that if the
FlatStyle is set to System, I can't change the BackColor
of the button, and I'm back to where I started....

/Henrik




-----Original Message-----
* "Henrik" <[email protected]> scripsit:

I am able to repro that. Setting the
button's 'FlatStyle' property to
 
H

Herfried K. Wagner [MVP]

* "Henrik said:
Thanks, that helped. Now the only problem is that if the
FlatStyle is set to System, I can't change the BackColor
of the button, and I'm back to where I started....

Setting the 'FlatStyle' property to 'System' won't allow you to change
the background color or use images on the button.
 
H

Henrik

Yes, I knew that (after all, that's the whole point of
letting the 'System' do the painting) but the original
problem still exists. Why is the text not aligned
correctly? I consider it to be a bug, unless someone
proves me otherwise.

/Henrik
 
H

Herfried K. Wagner [MVP]

* "Henrik said:
Yes, I knew that (after all, that's the whole point of
letting the 'System' do the painting) but the original
problem still exists. Why is the text not aligned
correctly? I consider it to be a bug, unless someone
proves me otherwise.

As mentioned previously, IMO that's a bug too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top