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

Using the keyboard to page through the page HTMLUIControl contents

Thread ID:

Created:

Updated:

Platform:

Replies:

145180 Jun 11,2019 01:45 PM UTC Jun 17,2019 09:00 AM UTC WinForms 3
loading
Tags: HTMLUIControl
Andy Foster
Asked On June 11, 2019 01:45 PM UTC

Hi,

Is it possible to use the keyboard to page up and down through a page using the HTMLUIControl?

I know that it ispossible to use the mouse to scroll through, but so far I hav been unable to find a way to achieve this through the keyboard. Sorry if I've missed something obvious.

Andy

Jagadeesan Pichaimuthu [Syncfusion]
Replied On June 12, 2019 12:37 PM UTC

Hi Andy, 
 
Thanks for using Syncfusion product. 
 
We have checked your requirement, but currently the HTMLUI control not have support for the page up and page down keys. You can refer the following documentation for the supported key operations in this control, 
 
 
But you can able to achieve your requirement by customizing the KeyUp event of the control. In HTMLUI control provides support to scroll by using the ScrollToElement(which scrolls to the particular element) and ScrollToRectangle(which is used to scroll to specific location). By using these methods you can able to perform the page up and page down operations, please refer the below code snippet and sample. 
 
this.htmluiControl1.KeyUp += HtmluiControl1_KeyUp; 
 
private void HtmluiControl1_KeyUp(object sender, KeyEventArgs e) 
{ 
    if(e.KeyData == Keys.PageDown) 
    { 
        this.ScrollToEnd(); 
    } 
    else if(e.KeyData == Keys.PageUp) 
    { 
        this.ScrollToTop(); 
    }             
} 
 
 
private void ScrollToTop() 
{ 
    IHTMLElement elem = this.htmluiControl1.Document.RenderRoot; 
    this.htmluiControl1.ScrollToElement(this.htmluiControl1.Document.RenderRoot); 
} 
 
private void ScrollToEnd() 
{ 
    IHTMLElement elem = this.htmluiControl1.Document.RenderRoot; 
    Point lastPoint = new Point(0, (elem.Location.Y + elem.Size.Height)); 
    Rectangle rect = new Rectangle(new Point(10, lastPoint.Y - 10), new Size(10, 10)); 
    this.htmluiControl1.ScrollToRectangle(rect, this.htmluiControl1.Document); 
} 
 
 
You can refer the below UG document for your reference. 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan 


Andy Foster
Replied On June 15, 2019 06:34 AM UTC

Thank you. With your suggestions and a couple of API calls I have been able to achieve page and line scrolling.

Appreciate your help.

Andy

Jagadeesan Pichaimuthu [Syncfusion]
Replied On June 17, 2019 09:00 AM UTC

Hi Andy, 
 
Thanks for your update. 
 
We are glad to know that the provided solution worked at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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