Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

changing font size on run-time


  • Please log in to reply

#1
yusufozkay

yusufozkay

    New Member

  • Member
  • Pip
  • 2 posts
hi! how can i change font size of a label on run-time in c#(or .net)?
  • 0

Advertisements


#2
BuRnEr

BuRnEr

    Member

  • Member
  • PipPip
  • 48 posts
......
in C# newer forget that whenever you use "new" keyword that time you are telling the compiler do this work on the heap, not on the stack...
and second when ever you creat object with "new" keyword that means that object will be known at run time not compile time.
this rule is so important in C# .......
....you have to know this rule by hearth.
and also virtual methods are known at run time too

and there is your solution simply.
//create new windows form in vs and insert the codes in and run it .
static void Main() //this is inserted automaticly by vs.net designer
{
Application.Run(new Form1());

}
/*=====================================*/

//you must isert this variable and function ...

Brush b;
protected override void OnPaint(PaintEventArgs e)
{
Graphics g=e.Graphics;
b=new SolidBrush(Color.Red);
Font f=new Font("Times New Roman",30);
g.DrawString("BuRnEr",f,b,1,25); }

if you dont understand anypoint here just highlight thi word that you did not understand and press F1 key msn help window come up.
and if you want to se how it is work just press F10, for more detail F11...

i hope it will help you
take care
  • 0

#3
yusufozkay

yusufozkay

    New Member

  • Topic Starter
  • Member
  • Pip
  • 2 posts
Thanks!
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP