Reputation: 412
I working with windows form application.I am confused how to decrease a font in the richtextbox. I try with my best knowledge but can't do it. I have try with the function. one most important a current font size will be must save..my coding part ::-
static int dmk;
public void fun()
{
int dk = Convert.ToInt32(richTextBox1.Font.Size); // font save run time
dmk = dk;
}
private void sizeDecreaseToolStripMenuItem_Click(object sender, EventArgs e)
{ int ab = dmk;
int ak = ab--;
// .Font = new Font(textBox.Font.FontFamily, 16);
richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, ak);
}
I want to my font decreased one button click like that in Microsoft word. The data only run time enter.
I know my English very bad. thanks in advanced...
Upvotes: 1
Views: 83
Reputation:
Use this code and see this question
Font font = richTextBox1.Font;
float newSize = font.Size;
newSize -= 2.0F;
richTextBox1.Font = new Font(font.FontFamily, newSize, font.Style);
Upvotes: 2