|
-
Jan 16th, 2007, 05:12 AM
#1
Thread Starter
Fanatic Member
quick question about creating buttons at runtime
Hi guys,
I am using .net compact framework 2.0.
This may be an easy question to answer but i cant seem to solve it myself. I am creating a button at run-time and i need the text on the button to appear on two lines. I want the button to say
Select
Image
When i say Button1.Text = "Select Image" it puts it on 1 line (and my button is not wide enough to display it on one line), and when i try
Button1.Text = "Select" & controlchars.newline & "Image", it never displays the image part of the text no matter how big i make the height of the button.
Can anybody tell me how to get the text on the button like i want it displayed above? And why none of my earlier attempts have worked.
Thanks in advance for any help.
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Jan 16th, 2007, 05:55 AM
#2
Re: quick question about creating buttons at runtime
This doesn't really solve your problem but I just tried setting the text to a multiline string at design time and that didn't work either. It doesn't look like a CF Button actually renders a line break as a line break, but rather tries to render the characters themselves and fails because they have no visual representation.
-
Jan 16th, 2007, 06:11 AM
#3
Thread Starter
Fanatic Member
Re: quick question about creating buttons at runtime
Ok thanks for the quick reply.
I guess i'll just have to shorten the text.
Thanks again

If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Jan 16th, 2007, 06:55 AM
#4
Frenzied Member
Re: quick question about creating buttons at runtime
Kimmy4:
I think it is the width you need to adjust and not the height.
And, it will also depend on the size of the font you are using.
If I use the following code I get "Select Image" on one line:
VB Code:
Me.Button1.Size = New System.Drawing.Size(78, 56)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Select Image"
If I reduce the width from 78 to 68 "Select Image" appears on two lines:
VB Code:
Me.Button1.Size = New System.Drawing.Size(68, 56)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Select Image"
I'm not sure if this will solve your problem or not.
Good Luck
-
Jan 16th, 2007, 06:58 AM
#5
Thread Starter
Fanatic Member
Re: quick question about creating buttons at runtime
Is that in the compact framework? When i adjust the width it jus cuts off part of the text from the beginning and end, keeping it all on one line!
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Jan 16th, 2007, 07:21 AM
#6
Frenzied Member
Re: quick question about creating buttons at runtime
Kimmy4:
No. Sorry, its VS2005.
And, it doesn't work the same in net compact framework 2.0.
-
Jan 16th, 2007, 07:21 AM
#7
Thread Starter
Fanatic Member
Re: quick question about creating buttons at runtime
Ok. Thanks.
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
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
|
Click Here to Expand Forum to Full Width
|