Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

What I am doing is setting the text of a couple of radiobuttons automatically, and I would like to put them up next to each other once the text is set, but there is no autowidth property for the radio button, so I was using "MeasureString" to get text width, but it doesnt work properly, seems to work "OK" for small strings, then you get a large string and its way out.

 

Any ideas????

 

thankyou

  • *Gurus*
Posted
It probably depends on the StringFormat you're using to draw the text. Use the CreateGraphics method of the radio button in question to get the graphics to measure from, then try passing StringFormat.GenericTypographic to the MeasureString method.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

STill Bad

 

Hi,

 

I tried using "StringFormat.GenericTypographic" which made it better but sting very wrong.

 

Until I get a chance to look at it again I am filling a label with the text, autosizing it and getting the width, and adding 20 for the button.

 

Dodgy but it works great!

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...