[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Globally Change Font Settings for Text and Label Controls

Posted on 2006-11-30
4
Medium Priority
?
250 Views
Last Modified: 2013-12-03
Hi,

I’m using VS.NET 2005.  The VS.NET font’s settings default is Microsoft Sans Serif, 8.25pt.  Is there a way to globally change the font size and type for all labels and text controls based on a setting or by code?


Thanks,
Denise
0
Comment
Question by:DeniseGoodheart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Assisted Solution

by:dctuck
dctuck earned 2000 total points
ID: 18053345
Hi Denise,

You change change the font which all controls use on a form by just changing your form's Font property from it's properties window.

0
 

Author Comment

by:DeniseGoodheart
ID: 18055072
Hi dctuck:

Thanks for your response.  I understand this is the way to do it individually, but I was curious if it was possible to globally change the font property using some kind of form control collection.  I need to experiment with font sizes for my customer, and I did not want to have to change all the font text controls and labels individually.  It looks like I might have to go into the properties for each form and change it individually, or do something like the following in code:


        Me.txtParameter1.Font.Size = New Size("12")


The code above does not work.  Any suggestion on how to fix it to work?


Thanks,
Denise

0
 
LVL 7

Accepted Solution

by:
dctuck earned 2000 total points
ID: 18055444
Hi Denise,

The Size property of Font is ReadOnly, so you would have to create a new font to do it that way e.g.:

Me.txtParameter1.Font = New Font("Arial",12)

Another alternative is to create a User setting in the Project Properties page as a System.Drawing.Font type, and set up different fonts in there. Then, from your code you can set the font as (assuming you create the Setting with the name MyFont):

Me.txtParameter1.Font = My.Settings.MyFont

or you can set your controls to use the font in designer view by selecting the Font settings under the (ApplicationSettings) dialog box for the control, which will then automatically bind that controls font to the MyFont font...

Hope that makes sense and helps!

Daniel
0
 

Author Comment

by:DeniseGoodheart
ID: 18055477
Hi Daniel,

I tried the following code and it actually globally changed all my form controls, and not just the one mentioned below:

 Me.Font = New Font(Me.txtStockedAS.Text, 11)


It must be some kind of bug.


Many Thanks,
Denise


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question