本文整理汇总了C#中AdornerLayer类的典型用法代码示例。如果您正苦于以下问题:C# AdornerLayer类的具体用法?C# AdornerLayer怎么用?C# AdornerLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AdornerLayer类属于命名空间,在下文中一共展示了AdornerLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAdorner
internal void AddAdorner(
AdornerLayer treeViewAdornerLayer, FrameworkElement adornedElement, ExplorerEFElement explorerElement,
ExplorerFrame explorerFrame)
{
var adornerY = GetAdornerY(adornedElement, explorerElement, explorerFrame);
if (adornerY >= 0)
{
SearchTickAdorner adorner;
if (!_adorners.TryGetValue(adornerY, out adorner))
{
adorner = new SearchTickAdorner(adornerY, adornedElement);
_adorners[adornerY] = adorner;
treeViewAdornerLayer.Add(adorner);
// adding adorners in batches of 100 - see bug: Windows OS Bugs 1750717
if ((_adorners.Count % 100) == 0)
{
treeViewAdornerLayer.UpdateLayout();
}
}
adorner.AddExplorerElement(explorerElement);
}
}
示例2: Plugitem_PreviewMouseMove
/// <summary>
/// 拖拽工具插头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Plugitem_PreviewMouseMove(object sender,MouseEventArgs e) {
if(e.LeftButton == MouseButtonState.Pressed) {
try {
AbstractCableKit drogKit = Kits_ListBox.SelectedItem as AbstractCableKit;
AbstractCableKit kit = (AbstractCableKit)drogKit.Clone();
Grid grid = sender as Grid;
var dragData = new DataObject(typeof(AbstractCableKit), kit);
Point pos = e.GetPosition(Kits_ListBox);
HitTestResult result = VisualTreeHelper.HitTest(Kits_ListBox, pos);
if (result == null)
return;
ListBoxItem listBoxItem = EquipmentUtils.FindVisualParent<ListBoxItem>(result.VisualHit); // Find your actual visual you want to drag
DragDropAdorner adorner = new DragDropAdorner(listBoxItem);
adornerLayer = AdornerLayer.GetAdornerLayer(this);
adornerLayer.Add(adorner);
DragDrop.DoDragDrop(grid, dragData, DragDropEffects.Copy);
adornerLayer.Remove(adorner);
adornerLayer = null;
}
catch
{
}
}
}
示例3: DraggingWidgetHelper
/// <summary>
/// Initialize the dragging helper
/// </summary>
/// <param name="panel"></param>
public DraggingWidgetHelper(Canvas panel)
{
Panel = panel;
adornerLayer = AdornerLayer.GetAdornerLayer(panel);
elements = new Dictionary<FrameworkElement, ResizingAdorner>();
ElementsRightBottom = new Dictionary<FrameworkElement, Point>();
}
示例4: drag_Rotate_Started
private void drag_Rotate_Started(DragListener drag)
{
_adornerLayer = this.adornerPanel.TryFindParent<AdornerLayer>();
var designerItem = this.ExtendedItem.Component as FrameworkElement;
this.parent = VisualTreeHelper.GetParent(designerItem) as UIElement;
this.centerPoint = designerItem.TranslatePoint(
new Point(designerItem.ActualWidth*designerItem.RenderTransformOrigin.X,
designerItem.ActualHeight*designerItem.RenderTransformOrigin.Y),
this.parent);
Point startPoint = Mouse.GetPosition(this.parent);
this.startVector = Point.Subtract(startPoint, this.centerPoint);
if (this.rotateTransform == null)
{
this.initialAngle = 0;
}
else
{
this.initialAngle = this.rotateTransform.Angle;
}
rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
}
示例5: DragAdorner
// Methods
public DragAdorner(UIElement adornedElement)
: base(adornedElement)
{
this.adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement);
this.InitializeAdornment();
DependencyPropertyDescriptor.FromProperty(DragDropState.MousePositionPropertyKey.DependencyProperty, base.AdornedElement.GetType()).AddValueChanged(base.AdornedElement, new EventHandler(this.MousePositionChanged));
}
示例6: WindowLoaded
private void WindowLoaded(object sender, RoutedEventArgs e)
{
adornerLayer = AdornerLayer.GetAdornerLayer(elementsGrid);
foreach (Panel toAdorn in elementsGrid.Children)
adornerLayer.Add(new ResizingAdorner(toAdorn.Children[0]));
}
示例7: AdornerDecorator
public AdornerDecorator()
{
AdornerLayer = new AdornerLayer();
((ISetLogicalParent)AdornerLayer).SetParent(this);
AdornerLayer.ZIndex = int.MaxValue;
VisualChildren.Add(AdornerLayer);
}
示例8: myCanvas_PreviewMouseLeftButtonDown
// Handler for element selection on the canvas providing resizing adorner
void myCanvas_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// Remove selection on clicking anywhere the window
if (selected)
{
selected = false;
if (selectedElement != null)
{
// Remove the adorner from the selected element
aLayer.Remove(aLayer.GetAdorners(selectedElement)[0]);
selectedElement = null;
}
}
// If any element except canvas is clicked,
// assign the selected element and add the adorner
if (e.Source != myCanvas)
{
_isDown = true;
_startPoint = e.GetPosition(myCanvas);
selectedElement = e.Source as UIElement;
_originalLeft = Canvas.GetLeft(selectedElement);
_originalTop = Canvas.GetTop(selectedElement);
aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
aLayer.Add(new ResizingAdorner(selectedElement));
selected = true;
e.Handled = true;
}
}
示例9: OnLoaded
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
canvas = this.GetVisualChild<Canvas>();
adornerlayer = AdornerLayer.GetAdornerLayer(this);
var designableDragAndResizeChrome = new DesignableResizeChrome(selection);
selectionAdorner = new DesignableResizeAdorner(canvas, selection, designableDragAndResizeChrome);
}
示例10: ClearAdorner
private static void ClearAdorner(AdornerLayer layer, LightBoxAdorner adorner)
{
// null条件演算子でいいかも。
if (layer != null && adorner != null)
{
layer.Remove(adorner);
}
}
示例11: ColumnReorderingDragSourceManager
public ColumnReorderingDragSourceManager( UIElement draggedElement,
AdornerLayer adornerLayerInsideDragContainer,
UIElement dragContainer,
bool enableAutoScroll,
bool showDraggedElementGhost )
: base( draggedElement, adornerLayerInsideDragContainer, dragContainer, enableAutoScroll, showDraggedElementGhost )
{
}
示例12: DraggedAdorner
public DraggedAdorner(AdornerLayer adornerLayer, UIElement uiElement, DataTemplate dragDropTemplate)
: base(uiElement)
{
this.contentPresenter = new ContentPresenter();
this.contentPresenter.ContentTemplate = dragDropTemplate;
this.adornerLayer = adornerLayer;
this.adornerLayer.Add(this);
}
示例13: DragAdorner
public DragAdorner(object data, DataTemplate dataTemplate, UIElement adornedElement, AdornerLayer adornerLayer)
: base(adornedElement)
{
_adornerLayer = adornerLayer;
_contentPresenter = new ContentPresenter() { Content = data, ContentTemplate = dataTemplate, Opacity = 0.75 };
_adornerLayer.Add(this);
}
示例14: DropPreviewAdorner
public DropPreviewAdorner(object feedbackUI, UIElement adornedElt, AdornerLayer layer)
: base(adornedElt)
{
Layer = layer;
presenter = new ContentPresenter();
presenter.Content = feedbackUI;
presenter.IsHitTestVisible = false;
}
示例15: Window_Loaded_1
private void Window_Loaded_1(object sender, RoutedEventArgs e)
{
myAdornerLayer = AdornerLayer.GetAdornerLayer(win);
myAdornerLayer.Add(new SimpleCircleAdorner(win));
//myAdornerLayer = AdornerLayer.GetAdornerLayer(pnl);
//foreach (UIElement toAdorn in pnl.Children)
// myAdornerLayer.Add(new SimpleCircleAdorner(toAdorn));
}