We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the base font size of the document rendered by the WinForms HTMLUIControl at run time?

Platform: WinForms |
Control: HTMLUIControl

Font size

The HTMLUI control allows the user to access the default format used for rendering the html document. The DefaultFormat.Font property helps in getting or setting the base font and its size while rendering in the HTMLUI control.

As like in popular web browsers, the user can change the font and increase or decrease the font size by changing the DefaultFormat.Font property of the HTMLUI control. The following code snippet shows how the base font size is changed during run time.


//Increasing the font size at run time by clicking a button
FontIncButton.Click += new System.EventHandler(FontIncButton_Click);
private void FontIncButton_Click(object sender, System.EventArgs e)
  //Increasing the DefaultFormat font size
  float fontSize = htmluiControl.DefaultFormat.Font.Size + 3;
  //Applying the changed size to the default format
  htmluiControl.DefaultFormat.Font = new Font(htmluiControl.DefaultFormat.Font.FontFamily, fontSize);



'Increasing the font size at run time by clicking a button
Private FontIncButton.Click += New System.EventHandler(FontIncButton_Click)
Private Sub FontIncButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  'Increasing the DefaultFormat font size
  Dim fontSize As Single = htmluiControl.DefaultFormat.Font.Size + 3
  'Applying the changed size to the default format
  htmluiControl.DefaultFormat.Font = New Font(htmluiControl.DefaultFormat.Font.FontFamily, fontSize)
End Sub


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile