gpt4 book ai didi

windows-phone-8 - Windows Phone 8 浏览器控件

转载 作者:行者123 更新时间:2023-12-04 21:19:36 26 4
gpt4 key购买 nike

我想在 windows phone 8 webbrowser control 中控制双击缩放,但我可以在 webbrowser control 中捕获双击事件。我也无法使用元标记属性指定缩放比例,因为我一直显示的页面来自第三方我也无法编辑 HTML 页面,任何人都遇到过这样的问题,这很明显我不能能够从中恢复超过 2 天,没有解决方案,

任何帮助将不胜感激!

问候,
马威,

最佳答案

嗨,这是我用于停止滚动、缩放和双击的代码,它在我的 Windows Phone 8 和 Windows Phone 8.1(SilverLight) 项目中运行良好

#region stop zoom and scroll
public bool ScrollDisabled { get; set; }
private void WB_Loaded(object sender, RoutedEventArgs e)
{
var border = WB.Descendants<Border>().Last() as Border;
ScrollDisabled = true;
border.ManipulationDelta += Border_ManipulationDelta;
border.ManipulationCompleted += Border_ManipulationCompleted;
border.DoubleTap += border_DoubleTap;
//Debug.WriteLine("Height " + border.Child);
//ContentPresenter cp = border.Child as ContentPresenter;
//Debug.WriteLine("ContentPresenter " + cp.Height);
//cp.Height = 650;
//Debug.WriteLine("ContentPresenter " + cp.Content);
//Grid gd = cp.Content as Grid;
//Debug.WriteLine("ContentPresenter " + gd.Children.First());
//border.MaxHeight = 700;
}

void border_DoubleTap(object sender, System.Windows.Input.GestureEventArgs e)
{
// suppress double-tap zoom
e.Handled = true;
}

private void Border_ManipulationCompleted(object sender,
ManipulationCompletedEventArgs e)
{

if (e.FinalVelocities.ExpansionVelocity.X != 0.0 ||
e.FinalVelocities.ExpansionVelocity.Y != 0.0
||(ScrollDisabled && e.IsInertial))
{
e.Handled = true;
Debug.WriteLine("Scroll ManipulationCompleted");
}
}

private void Border_ManipulationDelta(object sender,
ManipulationDeltaEventArgs e)
{
// suppress zoom
if (e.DeltaManipulation.Scale.X != 0.0 ||
e.DeltaManipulation.Scale.Y != 0.0)
e.Handled = true;

//optionally suppress scrolling
if (ScrollDisabled)
{
if (e.DeltaManipulation.Translation.X != 0.0 ||
e.DeltaManipulation.Translation.Y != 0.0)
e.Handled = true;
}
}
#endregion

对于这段代码,它需要一个我发布的 c# 类 here

关于windows-phone-8 - Windows Phone 8 浏览器控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15150932/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com