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


VulpesRank #55 · 29.2K reputationPosted Sep 7, 2011, 7:11 AM EDT
Try this instead:
lbl.Font = new Font(lbl.Font.FontFamily, number);
VulpesRank #55 · 29.2K reputationPosted Sep 6, 2011, 2:35 AM EDT
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 6, 2011, 4:03 AM EDT
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;
}
}
}
}
Abolfazl155 reputationPosted Sep 7, 2011, 7:00 AM EDT
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.
Abolfazl155 reputationPosted Sep 8, 2011, 12:24 PM EDT
thanks a lot vulpes ....