Reputation: 31
I made a note-taking app with c# forms. I want it to be almost fully customisable so I included a font dialog. But if the user selects higher font sizes than what I set. Buttons and labels looks very bad. So what I want is if the user wants to change the font, only the font style will be applied.A photo of the app
private void font_change_Click(object sender, EventArgs e)
{
fontDialog1.ShowApply = true;
fontDialog1.MaxSize = 40;
fontDialog1.MinSize = 8;
if(fontDialog1.ShowDialog()== DialogResult.OK)
{
title.Font = fontDialog1.Font;
message.Font = fontDialog1.Font;
}
}
private void fontDialog1_Apply(object sender, EventArgs e)
{
title.Font = fontDialog1.Font;
message.Font = fontDialog1.Font;
}
Upvotes: 0
Views: 883
Reputation: 48
Before button click
After button click
The Code
label1.Font = new Font("Yu Gothic", label1.Font.Size);
SO, We are only changing the font family while current font size will be the same. You Can do same with buttons on performing your action. Hope it works!
Upvotes: 2