Hi, my name is Abolfazl and beginner in c#.
I'm looking for change the size of label text with code.
I can change it by property window but I want to change it by code.foe example change it by menu.
I could change the color of label text by code but I couldn't change the style and size.
please help me !!!!!!!!!!
thanks
Loading

VulpesPosted Sep 7, 2011, 11:11 AM
Try this instead:
lbl.Font = new Font(lbl.Font.FontFamily, number);
AbolfazlPosted Sep 8, 2011, 4:24 PM
thanks a lot vulpes ....
AbolfazlPosted Sep 7, 2011, 11:00 AM
thanks for your guidance.
but I want to change the size of label text by code such as lbl.font.size=number;
but this code made an error.
Satyapriya NayakPosted Sep 6, 2011, 8:03 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
FontDialog fontDialog1 = new FontDialog();
if (fontDialog1.ShowDialog() != DialogResult.Cancel)
{
label1.Font = fontDialog1.Font;
}
}
}
}
VulpesPosted Sep 6, 2011, 6:35 AM