469,341 Members | 7,182 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,341 developers. It's quick & easy.

Word Wrap in CheckBox Text?

12
I know it's possible to wordwrap in a TextBox, but is it possible to do so in a CheckBox? This is a Win Mobile device, and the screen width is quite limited. I need the text wrapped, if longer than the width of the box, rather than truncated.

Is this possible, or am I going to have to create a custom object for this?
Dec 18 '08 #1
4 14674
nukefusion
221 Expert 100+
I don't know if it works the same for the compact framework but in standard winforms if you set the AutoSize property of the checkbox to False and reduce the width of the checkbox the text will wrap vertically in a similar fashion to the label.

Of course if you do that then it won't automatically resize to fit your text if you should change it, so you'd have to be careful or clever if you're implementing localization or if the text is dynamic in some way.
Dec 18 '08 #2
bjwest
12
Thanks nukefusion. I looked all through the compact frameworks CheckBox object and couldn't find anything that would do any kind of autosizeing. The CF is way limited, compared to the standard toolset. I understand they have to save space on the mobile devices, but you'd figure with smart phones being able to switch between portrait and landscape, they'd see the need for this ability. I guess I'm going to have to create a custom object.

The best I can figure is to create an object that contains a CheckBox with no label and a TextBox for the lable. If I set the TextBox to multi line with wordwrap, I can resize it as needed.

Off to the drawing board...
Dec 18 '08 #3
I think We creat a string str = "line1 \n line2 \n line3 ...";
Then checkbox.text = str;
Jan 2 '09 #4
bjwest
12
SaiLove, the CF checkbox does not have a multiline attribute. Anything after a newline is ignored and doesn't show in the textfield.

I got around this by creating my own custom control mentioned above. Right now, I'm trying to figure out how to resize the control when the vertical scrollbar is visible to prevent the horizontal scrollbar from being displayed.

This is a personal project I'm working that I've had to put on hold while developing a database app for the local Veterans Office
Jan 2 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Shawn Melton | last post: by
10 posts views Thread by Douglas G | last post: by
1 post views Thread by Bernerd | last post: by
10 posts views Thread by Jeff B. | last post: by
3 posts views Thread by Jim Bancroft | last post: by
3 posts views Thread by FUGATO | last post: by
9 posts views Thread by Joel Byrd | last post: by
10 posts views Thread by Lorenzo Thurman | last post: by
5 posts views Thread by momo | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.