)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to make the WinForms HTMLUIControl to scroll to a specific position during runtime?

Platform: WinForms |
Control: HTMLUIControl |
Published Date: April 30, 2011 |
Last Revised Date: January 3, 2020

Scrolling

The HTMLUI supports scrolling which helps the user in loading large documents inside the HTMLUI control and navigate to desired locations easily. The user can toggle the scroll control visibility at runtime.

C#

//Scrolling is enabled in the control.
htmluiControl.AutoScroll = true;

 

VB

'Scrolling is enabled in the control.
htmluiControl.AutoScroll = true

Methods like the ScrollToElement() and ScrollToRectangle() helps the user to customize the scroll positions at run time. 

The ScrollToElement() method scrolls such that the specified HTML element is visible in the control.

The ScrollToRectangle() method scrolls such that the specified Rectangle is visible in the control.

 

C#

IHTMLElement div = htmluiControl.Document.GetElementByUserId("div");
IHTMLElement p = htmluiControl.Document.GetElementByUserId("p");
Rectangle rect = new Rectangle(p.Location, p.Size);
private void btnDiv_Click(object sender, System.EventArgs e)
{
     htmluiControl.ScrollToElement(div);
}
private void btnP_Click(object sender, System.EventArgs e)
{
     htmluiControl.ScrollToRectangle(rect, htmluiControl.Document);
}

 

VB

Dim div As IHTMLElement
Dim p As IHTMLElement
div = htmluiControl.Document.GetElementByUserId("div")
p = htmluiControl.Document.GetElementByUserId("p")
Rectangle rect = new Rectangle(p.Location, p.Size)
private void btnDiv_Click(object sender, System.EventArgs e)
{
    htmluiControl.ScrollToElement(div)
}
private void btnP_Click(object sender, System.EventArgs e)
{
    htmluiControl.ScrollToRectangle(rect, htmluiControl.Document)
}

Hence with the HTMLUI control, scrolling is made easier and customizable which helps in developing advanced user interfaces.

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
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
Live Chat Icon