user1611221
user1611221

Reputation:

Change the font type dynamically in c#.net using windows app

I have two radio buttons: Marathi and English.

On the checked event of either I want to change the font of the text box.

I tried the following code, but it's not working:

txtPublisherName.font.fontfamily.equals("Elephant")

Upvotes: 0

Views: 2845

Answers (2)

Kishore Borra
Kishore Borra

Reputation: 269

By doing so you are checking whether txtPublisherName textbox current font is "Elephant" or not?

You can try this way

 textBox1.Font = new Font("Calibre", 20);

Upvotes: 0

Rob H
Rob H

Reputation: 1849

.Equals is a comparison. It just returns a bool, and does not set the value.

You'll need to create a new Font object for the font you want (e.g. Font font1 = new Font("Arial", 20); from here) and do txtPublisherName.Font = newFont

Upvotes: 3

Related Questions