473,418 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Changing a Control's Font Size during runtime

It it possible to change a button's or text box's font size during runtime?

When I try to build my application with this code:
this.ActiveControl.Font.Size = "8.25";
I get this error message:
Property or indexer "System.Drawing.Font.Size' cannot be assigned to -- it
is read only

I can change a button's text property during runtime, but I'd also like to
change the font size as well.
Nov 16 '05 #1
1 32205
Font is immutable. You cannot change its value. However, you can set the
Font property on the control you're working with, say,

this.ActiveControl.Font = new Font(this.ActiveControl.Font.FontFamily, 8.25,
this.ActiveControl.Font.Style);

-vJ

new Font(this.Font.FontFamily, 12, this.Font.Style);
"Jeff N" <Jeff N@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com...
It it possible to change a button's or text box's font size during
runtime?

When I try to build my application with this code:
this.ActiveControl.Font.Size = "8.25";
I get this error message:
Property or indexer "System.Drawing.Font.Size' cannot be assigned to -- it
is read only

I can change a button's text property during runtime, but I'd also like to
change the font size as well.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: BobK | last post by:
Hello Everyone, I am updating the CSS for my site but want new and original page to appear the same. My original CSS permits small increments of zooming (ctrl/mouse wheel) so that you get...
0
by: Eitan | last post by:
Hello, How can I change, within my code, the display font size from 96 DPI to 120 DPI? I would like to do it using either MFC or the Win32 SDK. Thanks, Eitan
1
by: Tom Rahav | last post by:
Hello. I use visual basic .net 2003 and Crystal Reports for creating win-reports. My question is if there is any possibility to set font properties (type, color and size) of a text control or...
5
by: dixie | last post by:
I want to be able to set the font size and font type for text in a text box on a report using VBA. I wan't to be able to control it from a setting in a table. The problem is that I don't know the...
3
by: Punisher | last post by:
I have a datagrid that I want to move another part of the page. I'm able to do this but the datagrid looses it's values after the move. General_DataGrid_CurrentItems is the datagrid name. I want...
2
by: iwdu15 | last post by:
ok, now i had a similar question involving changing colors from GDI to web, and i couldnt find a font translator class so here i am. I am trying to change rtf to html (w/o 3rd party extensions,...
40
by: Paul Davis | last post by:
Hi all, I'm building some style sheets and trying to play the old game of balancing designer pixel perfection and still allowing users to adjust their font sizes. The compromise I've made with the...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
3
by: MLH | last post by:
Without modifying the default font settings everywhere, is there any way to specify it for just message boxes? MsgBox "I would like this text to be larger for all message boxes." ???
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.