也许我有解决这个滚动问题的方法。它需要IE10(桌面版),但我记得在评论中读到过(被删除了吗?)这个项目的目标平台是Windows 7,所以希望你有自由在那里部署IE10。我在我的旧Asus Eee PC T91MT上进行了测试(Windows 7 SP1 w/
平台更新和
IE10),即使在那种硬件上,感觉还不错。
获取一个可用的VS2012项目,用于WinForms或WPF。
主要要点如下:
代码(C#):
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Navigation;
namespace WpfWbApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
SetBrowserCompatibilityMode();
InitializeComponent();
this.Loaded += MainWindow_Loaded;
this.WB.LoadCompleted += WB_LoadCompleted;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
this.WB.Navigate(new Uri(new Uri(Assembly.GetExecutingAssembly().CodeBase), "content/test.htm").AbsoluteUri);
}
void WB_LoadCompleted(object sender, NavigationEventArgs e)
{
this.WB.Focus();
this.WB.InvokeScript("focus");
}
private void SetBrowserCompatibilityMode()
{
var fileName = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName);
if (String.Compare(fileName, "devenv.exe", true) == 0)
return;
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION",
RegistryKeyPermissionCheck.ReadWriteSubTree))
{
UInt32 mode = 10000;
key.SetValue(fileName, mode, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BLOCK_LMZ_SCRIPT",
RegistryKeyPermissionCheck.ReadWriteSubTree))
{
UInt32 mode = 0;
key.SetValue(fileName, mode, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_NINPUT_LEGACYMODE",
RegistryKeyPermissionCheck.ReadWriteSubTree))
{
UInt32 mode = 0;
key.SetValue(fileName, mode, RegistryValueKind.DWord);
}
}
}
}
XAML:
<Window x:Class="WpfWbApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Touch and pan the picture" Width="1024" Height="800">
<WebBrowser Name="WB"></WebBrowser>
</Window>
HTML:
<!doctype html>
<html>
<head>
<style>
body { -ms-content-zooming:none; -ms-scroll-rails: none; }
</style>
</head>
<body style="overflow: auto">
<img src="panorama.jpg">
</body>
</html>
我没有触摸屏幕的IE9机器,所以无法测试它,尽管我确定它不会工作。显然,新的
Pointer Events Touch API是为Windows 7(通过
Platform Update)
专门为IE10引入的。
告诉我们它对你有什么作用。祝你好运!
[编辑]
更新了一个指向WinForms项目的链接。
ScrollViewer.SetPanningMode
。 - noseratio - open to work