本文整理汇总了C#中AdornerLayer.Add方法的典型用法代码示例。如果您正苦于以下问题:C# AdornerLayer.Add方法的具体用法?C# AdornerLayer.Add怎么用?C# AdornerLayer.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdornerLayer
的用法示例。
在下文中一共展示了AdornerLayer.Add方法的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: 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]));
}
示例4: 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;
}
}
示例5: 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);
}
示例6: 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));
}
示例7: PostionAdorner
public PostionAdorner(UIElement adornedElement, AdornerLayer adornerLayer, DataTemplate dataTemplate)
: base(adornedElement)
{
_adornerLayer = adornerLayer;
_contentPresenter = new ContentPresenter();
_contentPresenter.ContentTemplate = dataTemplate;
//加入层中
_adornerLayer.Add(this);
}
示例8: HighLight_Adorner
public HighLight_Adorner(UIElement adornedElement,
Point startPosition, Size size,double opacity,
AdornerLayer adornerLayer)
: base(adornedElement)
{
this.opacity = opacity;
this.size = size;
this.adornerLayer = adornerLayer;
adornerLayer.Add(this);
this.position = startPosition;
}
示例9: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e) {
aLayer = AdornerLayer.GetAdornerLayer(textBox1);
aLayer.Add(new ScaleAdorner(textBox1));
//this.MouseLeftButtonDown += new MouseButtonEventHandler(Window1_MouseLeftButtonDown);
//this.MouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler);
//this.MouseMove += new MouseEventHandler(Window1_MouseMove);
//this.MouseLeave += new MouseEventHandler(Window1_MouseLeave);
//myCanvas.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(myCanvas_PreviewMouseLeftButtonDown);
//myCanvas.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler);
}
示例10: DragAdorner
/// <summary>
/// Initializes a new instance of the <see cref="DragAdorner"/> class.
/// </summary>
/// <param name="data">The data that's being dragged.</param>
/// <param name="dataTemplate">The data template to show while dragging.</param>
/// <param name="adornedElement">The adorned element.</param>
/// <param name="adornerLayer">The adorner layer.</param>
public DragAdorner(object data, DataTemplate dataTemplate, UIElement adornedElement, AdornerLayer adornerLayer)
: base(adornedElement)
{
Argument.IsNotNull("data", data);
Argument.IsNotNull("adornerLayer", adornerLayer);
_myAdornerLayer = adornerLayer;
_myContentPresenter = new ContentPresenter { Content = data, ContentTemplate = dataTemplate, Opacity = 0.75 };
_myAdornerLayer.Add(this);
}
示例11: AddImageResizers
public void AddImageResizers(RichTextBox editor)
{
var images = GetVisuals(editor).OfType<Image>();
al = AdornerLayer.GetAdornerLayer(editor);
foreach (var image in images)
{
current = new ResizingAdorner(new ResizingAdorner(image));
//ResizingAdorner ral = new ResizingAdorner(image);
al.Add(current);
al.Update();
//LIBTODO:
}
}
示例12: SimDoubleClick
private void SimDoubleClick(object sender, MouseButtonEventArgs e) {
bool canDrawOutPlug = BackPanelUtil.SimDoubleClick(sender, e);
if (canDrawOutPlug) {
SocketAttatch.SetPlugOut(this, 1);
} else {
PlugInfoAdorner adorner = new PlugInfoAdorner(this);
mAdornerLayer = AdornerLayer.GetAdornerLayer(this);
mAdornerLayer.Add(adorner);
// mAdornerLayer.Remove(adorner);
// mAdornerLayer = null;
}
}
示例13: Update
public void Update(DropType dropType)
{
if (_layer == null)
{
_layer = AdornerLayer.GetAdornerLayer(AdornedElement);
_layer.Add(this);
}
_parentAdorner?.Remove();
_dropType = dropType;
_layer.Update(AdornedElement);
Visibility = Visibility.Visible;
}
示例14: DraggedAdorner
public DraggedAdorner(object dragDropData, DataTemplate dragDropTemplate, UIElement adornedElement,
AdornerLayer adornerLayer)
: base(adornedElement)
{
_adornerLayer = adornerLayer;
_contentPresenter = new ContentPresenter
{
Content = dragDropData,
ContentTemplate = dragDropTemplate,
Opacity = AdornerOpacity
};
_adornerLayer.Add(this);
}
示例15: dc_PropertyChanged
void dc_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "LeftPictureLocation")
{
var doesThisWork = VisualTreeHelper.GetChild(leftItemsControl, 0);
var doesThisWorkt = VisualTreeHelper.GetChild(doesThisWork, 0);
var doesThisWorktt = VisualTreeHelper.GetChild(doesThisWorkt, 0);
canvasToTouch = (Canvas)doesThisWorktt;
myAdornerLayer = AdornerLayer.GetAdornerLayer((Visual)doesThisWorktt);
ad = new SimpleCircleAdorner((UIElement)doesThisWorktt);
myAdornerLayer.Add(ad);
myAdornerLayer.IsHitTestVisible = false;
}
}