-
Automatically Resizing Control buttons at runtime
I am having a problem with a program in which I have to create a group of
option button controls at runtime and put them in the same frame container.
The problem is resizing the individual option buttons depending on the size
of the caption that each needs to display which can vary a lot. With a label
it is easy by using the autosize and wordwrap properties of the control but
I am not sure how to set the option buttons to the appropriate width and
height depending on the size of their caption property. Does anyone know
of a way to automatically resize option button controls at runtime depending
on the size of the caption they have to display ??????
Please help....
-
Re: Automatically Resizing Control buttons at runtime
"Daniel Noack" <dnoack@fbrice.com.au> wrote:
>
>I am having a problem with a program in which I have to create a group of
>option button controls at runtime and put them in the same frame container.
>The problem is resizing the individual option buttons depending on the size
>of the caption that each needs to display which can vary a lot. With a label
>it is easy by using the autosize and wordwrap properties of the control
but
>I am not sure how to set the option buttons to the appropriate width and
>height depending on the size of their caption property. Does anyone know
>of a way to automatically resize option button controls at runtime depending
>on the size of the caption they have to display ??????
>Please help....
Hi,
There is an API called GetTextExtentPoint32() you can use to get the height
and width of a specific string. If you're not familiar with API's there is
a simplier approach. Put an invisible label somewhere on the form and set
AutoSize to True. Ensure the font used is the same type and size as with
the button. Set the labels caption with the string and read the width property.
Bernie
-
Re: Automatically Resizing Control buttons at runtime
Daniel, here is another solution that might work for you. I don't like the
way option button/checkbox captions are grayed when disabled, unlike other
labels on my forms, so I omit the captions, set the size to 200x200 and align
labels to replace the captions. The labels have the same index property
as the corresponding button or checkbox so when one receives focus the program
underlines the label.
Caroline
"Bernie" <magnus.bernroth@rejlers.se> wrote:
>
>"Daniel Noack" <dnoack@fbrice.com.au> wrote:
>>
>>I am having a problem with a program in which I have to create a group
of
>>option button controls at runtime and put them in the same frame container.
>>The problem is resizing the individual option buttons depending on the
size
>>of the caption that each needs to display which can vary a lot. With a
label
>>it is easy by using the autosize and wordwrap properties of the control
>but
>>I am not sure how to set the option buttons to the appropriate width and
>>height depending on the size of their caption property. Does anyone know
>>of a way to automatically resize option button controls at runtime depending
>>on the size of the caption they have to display ??????
>>Please help....
>
>Hi,
>
>There is an API called GetTextExtentPoint32() you can use to get the height
>and width of a specific string. If you're not familiar with API's there
is
>a simplier approach. Put an invisible label somewhere on the form and set
>AutoSize to True. Ensure the font used is the same type and size as with
>the button. Set the labels caption with the string and read the width property.
>
>Bernie
>
-
Re: Automatically Resizing Control buttons at runtime
Dear Daniel,
U can set width and height of ur control same as height of ur user control.
In user control resize event.
Neelam
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks