2
private void arrButton_Click(object sender, EventArgs e)
{
    Button button = (Button)sender;
    if (turn == 0)
    {
        button.Text = "X";
        button.Enabled = false;
        turn = 1;
    }
    else
    {
        button.Text = "O";
        button.Enabled = false;
        turn = 0;
    }
}

I have an array button, When I resize the buttons by code: larger or smaller. I want to resize font X, O. How do it by code?

0

2 Answers 2

19

The Fontsize can be set as follows :

int newSize = 10;
button.Font = new Font(button.Font.FontFamily, newSize);

I hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

-1

I think u r looking for something like:

button.Font.Size = FontUnit.Point(32);
 // OR
button.Font.Size = FontUnit.Larger;

2 Comments

Error : The name "FontUnit" does not exist in the current context
Is it a web application or windows application ? The one i suggested is web application and uses the " System.Web.UI.WebControls" namespace

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.