本文整理汇总了C#中System.Windows.Point.ScreenToData方法的典型用法代码示例。如果您正苦于以下问题:C# Point.ScreenToData方法的具体用法?C# Point.ScreenToData怎么用?C# Point.ScreenToData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Point
的用法示例。
在下文中一共展示了Point.ScreenToData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Chart_PreviewMouseLeftButtonDown
private void Chart_PreviewMouseLeftButtonDown(object sender, RoutedEventArgs e)
{
var transform = Plotter.Viewport.Transform;
System.Windows.Point mousePos = mouseTrack.Position;
mouseScreenPosition = Mouse.GetPosition(Plotter.CentralGrid);
//System.Diagnostics.Debug.WriteLine("Start: " + mouseScreenPosition);
var mousePositionInData = mouseScreenPosition.ScreenToData(transform);
var screenPos = mousePositionInData.DataToScreen(transform);
//System.Diagnostics.Debug.WriteLine(mousePositionInData);
if (IsShiftPressed()) //make note
{
xValue = mousePositionInData.X;
yValue = mousePositionInData.Y;
String note = MakeNote();
if (note != "")
{
NoteTable.Add(xValue, note);
}
}
else if (IsControlPressed())
{
}
else if (IsAltPressed()) // change window zoom
{
if (ZoomedIn)
{
ZoomOut();
ZoomedIn = false;
}
else
{
xValue = mousePositionInData.X;
yValue = mousePositionInData.Y;
xMinWindowWhenZoomed = xValue - 50;
yMinWindowWhenZoomed = yValue - 50;
ZoomIn(xValue, yValue);
ZoomedIn = true;
}
}
else //normal left click sync videos to click location
{
if (ZoomedIn)
{
xValue = mousePositionInData.X;
yValue = mousePositionInData.Y;
}
else
{
xValue = mousePositionInData.X;
yValue = mousePositionInData.Y;
}
//System.Diagnostics.Debug.WriteLine("int: " + (int)xValue);
TimeSpan ts = new TimeSpan(0, 0, 0, 0, (int)(xValue * 1000));
RightChangePosition(ts);
LeftChangePosition(ts);
}
}