滚动按钮,按住按钮时连续滚动? [英] Buttons for scrolling, continuous scrolling when holding down button?

查看:75
本文介绍了滚动按钮,按住按钮时连续滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我正在尝试让我的网络浏览器使用以下代码滚动按钮:



 私有  Sub  WebBrowser1_DocumentCompleted(sender  As   Object ,e  As  WebBrowserDocumentCompletedEventArgs)句柄 WebBrowser1.DocumentCompleted 
WebBrowser1.ScrollBarsEnabled = False
结束 Sub

私有 Sub Button9_Click(sender 作为 对象,e 作为 EventArgs)句柄 Button9.Click
WebBrowser1.Document.Body.ScrollTop = WebBrowser1.Document.Body.Scrol lTop - 10

结束 Sub

私有 Sub Button10_Click(发件人作为 对象,e As EventArgs)句柄 Button10.Click
WebBrowser1.Document.Body.ScrollTop = WebBrowser1.Document.Body.ScrollTop + 10

结束 Sub





我想知道是否有人可以帮我设置它,这样当我点击并按住按钮时,它会不断向下滚动,直到你释放点击,就像一个普通的滚动bar。

解决方案

在C#中你可以添加一个计时器并做这样的事情

  int  position =  0 ; 
private void button1_MouseDown( object sender,MouseEventArgs e)
{
timer1.Start();
}

private void button1_MouseUp( object sender,MouseEventArgs e)
{
timer1.Stop();
}

private void timer1_Tick( object sender,EventArgs e)
{
position ++;
}



然后计时器的每个滴答都会设置位置。

您将不得不更改代码对于你可以使用的东西,

但是你在这里得到了大图。


将10改为50,不是解决方案,但滚动更容易。

Hey, I'm trying to get my web browser to scroll by button using this code:

Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    WebBrowser1.ScrollBarsEnabled = False
End Sub

Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
    WebBrowser1.Document.Body.ScrollTop = WebBrowser1.Document.Body.ScrollTop - 10

End Sub

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
    WebBrowser1.Document.Body.ScrollTop = WebBrowser1.Document.Body.ScrollTop + 10

End Sub



I was wondering if someone could help me set it up so that when I click and hold down the button, it will continuously scroll down until you release the click, like a normal scroll bar.

解决方案

In C# you could add a timer and do something like this

int position = 0;
private void button1_MouseDown(object sender, MouseEventArgs e)
{
    timer1.Start();
}

private void button1_MouseUp(object sender, MouseEventArgs e)
{
    timer1.Stop();
}

private void timer1_Tick(object sender, EventArgs e)
{
    position++;
}


Then every tick of the timer will set the position.
You will have to change the code to something you could use,
but you get the big picture here.


Changed 10 to 50, not a solution but it's easier to scroll.


这篇关于滚动按钮,按住按钮时连续滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆