I have a form with a textbox and 2 buttons. I need the 2 buttons to increase and decrease the text size when clicked. Is there a way I can do this?
Assuming you are using winforms
Create two buttons named: btnFontSizeUp
and btnFontSizeDown
use the following code on click events:
btnFontSizeUp on click:
float currentSize;
currentSize = textboxName.Font.Size;
currentSize += 2.0F;
textboxName.Font = new Font(textboxName.Font.Name, currentSize,
textboxName.Font.Style, textboxName.Font.Unit);
btnFontSizeDown on click:
float currentSize;
currentSize = textboxName.Font.Size;
currentSize -= 2.0F;
textboxName.Font = new Font(textboxName.Font.Name, currentSize,
textboxName.Font.Style, textboxName.Font.Unit);