473,657 Members | 2,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Font.Size

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.Siz e = 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
2 57232
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.goo gle.com...
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.Siz e = 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
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.Fo ntFamily, myLabel.Font.Si ze + 1);

HTH,
Michael Zino

"Bjoern" <vs*****@web.de > wrote in message
news:1b******** *************** ***@posting.goo gle.com...
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.Siz e = 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3170
by: kmunderwood | last post by:
I am having trouble changing the font size when extracting xml into an html web page. I think it can be done so many ways, that my searches bring up examples that I am not familiar with. I am a newbie at xml and xsl This is my xml("index.xml")page(I can not change this, it comes to me this way. <?xml version="1.0" encoding="iso-8859-1" ?>
16
14524
by: Coder Droid | last post by:
I'm trying my first table-less site, and I've bumped my head up against a wall. I can't change the font size within a div. Real quick, my style sheet has: ------------------------------------- body { font: 8pt "face" } #nav {float: left; width: 144px; } #test { font: 12pt; font-weight: bold } -------------------------------------
15
7176
by: lharby | last post by:
Basic question, is this possible? I have managed to crib a javascript function that allows the user to increase or decrease the font size of a page. (see http://www.northamptontoday.co.uk/ViewArticle.aspx?SectionID=317&ArticleID=867063 for example. A+ A- in top right). A div id is used to apply the function to text within that id. My problem: I am working with a large intranet, all of the page
5
130273
by: VB Programmer | last post by:
How can I change the font size of a text box dynamically? I tried this but it didn't work. It said 'Size is Read-Only'. Any other ways around this? Here's the code: txtDisplay.Font.Size = 10
2
41180
by: Dave | last post by:
How can I change the font size of a label? I have: Label1.Font.Size = "12" but it's telling me that property 'Size' is readonly. Thanks,
1
7847
by: ken | last post by:
Hi, How do you change the font for the data labels on your bar graph report/chart? I have 24 series, and when I change the font of the data label for one series that does not change them all... Also in design view I only have 3 series displayed...so I need a way to change all of them at once... If anyone knows how to do this I would really appreciate a hint. Thanks
3
3029
by: # Cyrille37 # | last post by:
Hello, Font.Size Property is readonly. How can I change the Size of a Font ??? Thanks for your help cyrille
5
3057
by: _Who | last post by:
I spent all day yesterday trying different things. Something has happened so I can't change font size. I have a table and in the first cell I have only text. I tried using the cell's Style to change the font size. I tried using the cell's attribute to change the font size. I tried adding a paragraph element and doing the above to it. Removed all font sizes from Body, Table...
3
3843
by: reyo | last post by:
Hi, i design a dynamic web page.infact it will be a css generator. i have a question about visited link. i want to change color,font-size,font-weight etc. of a link when it is visited. when a user change font-size dynamically visited link's font-size will be change. i use dropdown list for font-size values . there are 24 links on the page.links id="a1" a2,a3, so on.. function denemelink(){ var...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.