我们有一个C#容器,在没有垂直滚动(仅水平)的网站上调用了Windows.Form.WebBrowser类。
使用触摸屏在Internet Explorer,Chrome和Firefox中滚动效果很好,但是当在Windows.Form.WebBrowser内部启动网站时,触摸滚动功能不起作用。它注册触摸/拖动事件,如左键单击并拖动而不抓取网站。
它还将选择以下网站上的文字。
我们创建了一个示例网站来演示此问题:
Test website with side scroll. On a touch screen drag and scroll works
namespace WindowsFormsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.SuspendLayout();
//
// webBrowser1
//
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point(0, 0);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.ScrollBarsEnabled = false;
this.webBrowser1.Size = new System.Drawing.Size(2419, 1088);
this.webBrowser1.TabIndex = 0;
this.webBrowser1.Url = new System.Uri("https://beta.slimcrm.com/sideScrollTest.html", System.UriKind.Absolute);
this.webBrowser1.AllowNavigation = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(16F, 31F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(2419, 1088);
this.Controls.Add(this.webBrowser1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.WebBrowser webBrowser1;
}
}
我们有2位开发人员通过此网站和互联网搜索了2天,但我们尝试的任何内容似乎都不允许C#Windows.Form.WebBrowser注册触摸事件并将网站拖到左侧。
我们认为它必须与C#联系在一起,因为触摸屏上的拖动事件在所有Web浏览器中都能很好地运行。该网站的框架是Knockout.js,Restful API,所有这些都在C#容器中。