本文整理汇总了C#中Point.ScreenToViewport方法的典型用法代码示例。如果您正苦于以下问题:C# Point.ScreenToViewport方法的具体用法?C# Point.ScreenToViewport怎么用?C# Point.ScreenToViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.ScreenToViewport方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartPanning
protected virtual void StartPanning(MouseButtonEventArgs e)
{
panningStartPointInScreen = e.GetPosition(this);
panningStartPointInViewport = panningStartPointInScreen.ScreenToViewport(Viewport.Transform);
Plotter2D.UndoProvider.CaptureOldValue(Viewport, Viewport2D.VisibleProperty, Viewport.Visible);
isPanning = true;
CaptureMouse();
}
示例2: MouseWheelZoom
private void MouseWheelZoom(Point mousePos, int wheelRotationDelta)
{
Point zoomTo = mousePos.ScreenToViewport(Viewport.Transform);
double zoomSpeed = Math.Abs(wheelRotationDelta / Mouse.MouseWheelDeltaForOneLine);
zoomSpeed *= wheelZoomSpeed;
if (wheelRotationDelta < 0)
{
zoomSpeed = 1 / zoomSpeed;
}
Viewport.Visible = Viewport.Visible.Zoom(zoomTo, zoomSpeed);
}
示例3: UpdateLittleVisible
private void UpdateLittleVisible(Point pos)
{
Size littleSize = new Size(Plotter2D.Viewport.Visible.Width / zoomCoeff * ActualWidth / Plotter2D.Viewport.Output.Width,
Plotter2D.Viewport.Visible.Height / zoomCoeff * ActualHeight / Plotter2D.Viewport.Output.Height);
Rect littleVisible = RectExtensions.FromCenterSize(pos.ScreenToViewport(Plotter2D.Viewport.Transform), littleSize);
littlePlotter.Viewport.Visible = littleVisible;
}
示例4: CentralGrid_MouseLeftButtonUp
void CentralGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (isCtrlPressed) {
Plotter.MainCanvas.Children.Remove(zoomingRect);
Point currPosution = e.GetPosition(Plotter.CentralGrid);
Point p1 = zoomingRectStartPointInScreen.ScreenToViewport(Viewport.Transform);
Point p2 = new Point();
if (currPosution.X < zoomingRectStartPointInScreen.X)
p2.X = zoomingRectStartPointInScreen.X - zoomingRect.Width;
else
p2.X = currPosution.X;
if (currPosution.Y < zoomingRectStartPointInScreen.Y)
p2.Y = zoomingRectStartPointInScreen.Y - zoomingRect.Height;
else
p2.Y = currPosution.Y;
p2 = p2.ScreenToViewport(Viewport.Transform);
Rect newVisible = new Rect(p1, p2);
Viewport.Visible = newVisible;
}
else
if (isPanning)
{
//Point panningEndPointInScreen;
//panningEndPointInScreen = e.GetPosition(Plotter.CentralGrid);
//panningEndPointInViewport = panningEndPointInScreen.ScreenToViewport(Viewport.Transform);
//relocateVisisble();
isPanning = false;
}
}
示例5: OnMouseLeftButtonDown
protected virtual void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
lmbInitialPosition = e.GetPosition(listeningPanel);
var foundActivePlotter = UpdateActivePlotter(e);
if (foundActivePlotter)
{
lmbPressed = true;
dragStartInViewport = lmbInitialPosition.ScreenToViewport(activePlotter.Transform);
listeningPanel.Background = fillBrush;
listeningPanel.CaptureMouse();
e.Handled = true;
}
}
示例6: StartPanning
protected virtual void StartPanning(MouseButtonEventArgs e)
{
panningStartPointInScreen = e.GetPosition(this);
panningStartPointInViewport = panningStartPointInScreen.ScreenToViewport(Viewport.Transform);
Plotter2D.UndoProvider.CaptureOldValue(Viewport, Viewport2D.VisibleProperty, Viewport.Visible);
isPanning = true;
// not capturing mouse because this made some tools like PointSelector not
// receive MouseUp events on markers;
// Mouse will be captured later, in the first MouseMove handler call.
// CaptureMouse();
Viewport.PanningState = Viewport2DPanningState.Panning;
//e.Handled = true;
}
示例7: OnMouseLeftButtonDown
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
lmbInitialPosition = e.GetPosition(this);
dragStart = lmbInitialPosition.ScreenToViewport(Transform);
lmbPressed = true;
content.Background = fillBrush;
CaptureMouse();
}