本文整理汇总了C#中System.Windows.FrameworkElement.IsActivity方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.IsActivity方法的具体用法?C# FrameworkElement.IsActivity怎么用?C# FrameworkElement.IsActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.IsActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseMoveMethod
private void MouseMoveMethod(FrameworkElement element, Point currentPosition)
{
double scale = 1;
if (element.IsActivity())
{
scale = ((ScaleResizingAdorner)elements[element]).Scale;
}
double left = (currentPosition.X - clickPoint.X * scale);
double top = (currentPosition.Y - clickPoint.Y * scale);
left = Math.Max(left, 0);
top = Math.Max(top, 0);
Canvas.SetLeft(element, left);
Canvas.SetTop(element, top);
}
示例2: AddWidget
/// <summary>
/// Add an element
/// </summary>
/// <param name="element"></param>
public void AddWidget(FrameworkElement element)
{
element.Cursor = Cursors.SizeAll;
element.AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MouseLeftButtonDown), true);
element.AddHandler(FrameworkElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(MouseLeftButtonUp), true);
element.AddHandler(FrameworkElement.MouseMoveEvent, new MouseEventHandler(MouseMove), true);
ResizingAdorner adorner = element.IsActivity() ? new ScaleResizingAdorner(element) : new ResizingAdorner(element);
adorner.WidgetDragging += OnWidgetDragging;
adornerLayer.Add(adorner);
elements.Add(element, adorner);
ElementsRightBottom.Add(element, new Point()); // element may has not loaded
}
示例3: MouseLeftButtonUpMethod
private void MouseLeftButtonUpMethod(FrameworkElement element)
{
element.ReleaseMouseCapture();
isMouseCaptured = false;
double scale = 1;
if (element.IsActivity())
{
scale = ((ScaleResizingAdorner)elements[element]).Scale;
}
OnWidgetDragging(element, new WidgetDraggingEventArgs(new Point(
Canvas.GetLeft(element) + element.ActualWidth * scale, Canvas.GetTop(element) + element.ActualHeight * scale)));
}