By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,883 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,883 IT Pros & Developers. It's quick & easy.

Change Font.Size

P: n/a
Hi all,
how can i change the Font Size of the Text in my Label.
I will change it dynamic in the code.
I tryed:
int number = 11;
label1.Font.Size = number;
But this is not possible because Size is Write-Protected.
There is only a Get-Method and no Set.
Plz Help
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Create a new font using the font family of the existing font and the desired
size

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Bjoern" <vs*****@web.de> wrote in message
news:1b**************************@posting.google.c om...
Hi all,
how can i change the Font Size of the Text in my Label.
I will change it dynamic in the code.
I tryed:
int number = 11;
label1.Font.Size = number;
But this is not possible because Size is Write-Protected.
There is only a Get-Method and no Set.
Plz Help

Nov 15 '05 #2

P: n/a
Hello,
Although, the Size property is read-only, the Font property itself is not.
Therefore, you can change the font dynamically:

myLabel.Font = new Font( myLabel.Font.FontFamily, myLabel.Font.Size + 1);

HTH,
Michael Zino

"Bjoern" <vs*****@web.de> wrote in message
news:1b**************************@posting.google.c om...
Hi all,
how can i change the Font Size of the Text in my Label.
I will change it dynamic in the code.
I tryed:
int number = 11;
label1.Font.Size = number;
But this is not possible because Size is Write-Protected.
There is only a Get-Method and no Set.
Plz Help

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.