Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 7th, 2005, 11:46 PM   #1
myName
Programmer
 
Join Date: Oct 2005
Posts: 48
Rep Power: 0 myName is on a distinguished road
Unhappy Button font size programmatically???

I have buttons that created programmatically, how to set the button's fon size programmatically?

for( int nCounter=0; nCounter <MaxNumber ; nCounter++ )
{
Button tempButton = new Button();

tempButton.Top = ....;
tempButton.Left = ....;
tempButton.Height = ....;
tempButton.Height = 90;
tempButton.Width = 86;
tempButton.Parent = this;
tempButton.Enabled = true;
tempButton.BackColor = Color.Gray;
tempButton.TextAlign = ContentAlignment.BottomCenter;

.....
}
myName is offline   Reply With Quote
Old Nov 8th, 2005, 12:51 AM   #2
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 825
Rep Power: 4 The Dark is on a distinguished road
Try something like:
tempButton.Font = new Font(tempButton.Font.FontFamily,  26);
where 26 is the size of the new font.
I haven't tried this, I just read the documentation.
The Dark is offline   Reply With Quote
Old Nov 8th, 2005, 1:45 AM   #3
myName
Programmer
 
Join Date: Oct 2005
Posts: 48
Rep Power: 0 myName is on a distinguished road
Thank you, The Dark.

It's work. :-)

I also added somrthing like this :
tempButton.Font = new Font(tempButton.Font.FontFamily, 10, tempButton.Font.Style | FontStyle.Bold);

to make the font bold.
myName is offline   Reply With Quote
Old Nov 8th, 2005, 1:46 AM   #4
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
Quote:
Originally Posted by myName
Thank you, The Dark.

It's work. :-)

I also added somrthing like this :
tempButton.Font = new Font(tempButton.Font.FontFamily, 10, tempButton.Font.Style | FontStyle.Bold);

to make the font bold.
Cool, good to see its working. And it's great when you experiment with stuff and it works.
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:08 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC