Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
Strange problem here. If i create a button (in C# or VB) the text won't TRUELY center unless the "flatStyle" property is set to "System" for that button. Does anyone know why this is? It only seems to do this when the text is so long (for example "Change Account Number"). Try it in your IDE, i am sure it will happen. This doesn't seem promising for a newbie to .net.
Posted

Centre

 

It only moves the text slightly when you change from 'flat' etc. to 'System.'

 

Isn't this because 'system' appears in 3D and therefore some of the object is used for shading, not the actual front of the button.

"Today I saw a little worm wriggling on his belly. Perhaps he'd like to come inside and see what's on the telly." - Spike Milligan (Tribute).
Posted

Here is a complete...OMG stab in the dark..

 

Is it something to do with the actual font being used? Try using courier new and see the result.

My website
Posted
Hey, thanks. I tried aerial last night, and it did the same thing, so i didn't think it was the font, but Courier works nicely. Is there a fix? I like the ms font, but alas, i am not totally held down to using "System" style buttons.
Posted

I think it has something to do with proportional fonts or something? This I think is where in a given font it spaces the letters evenly, W I for example.

 

Not sure if thats a good explanation but I think it is close:)

My website
  • 1 year later...
Posted
true type fonts (as most are today) are unevenly spaced so that they will look nicer according to whatever rules they were created. On the other hand monotype fonts such as courier new have a fixed length for each character (as was on a typewriter block)
  • Leaders
Posted
Um... the fact is that when you use the Standard flatstyle, the .Net framework is rending your button and when you use the System flatstyle, windows is rendering your button. The difference is between who is rendering it, not the fonts. If you say that it is off center only when it is too long, it may be a minor bug in the .net framework, and yes, this may only occur with certain fonts or by something like roundoff error when cleartype is on or something. My guess is that it is always slightly off center (again, perhaps only with certain fonts) and the off-centerness is only noticable when the string is long enough that it reaches close to the left and right edges of the button.
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...