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.
Unfortunately, activation email could not send to your email. Please try again.

How do I change the Base font size of the document rendered by the HTMLUI control at run time?

 

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.

C#

//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);

}

VB

'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

 

Article ID: Published Date: Last Revised Date: Platform: Control:
817 04/30/2011 07/10/2014 Windows Forms HTMLUIControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.