本文整理汇总了C#中VisualCollection类的典型用法代码示例。如果您正苦于以下问题:C# VisualCollection类的具体用法?C# VisualCollection怎么用?C# VisualCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisualCollection类属于命名空间,在下文中一共展示了VisualCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResizingAdorner
/// <summary>
/// Initialize the ResizingAdorner.
/// </summary>
/// <param name="adornedElement">The element to be adorned.</param>
public ResizingAdorner(UIElement adornedElement)
: base(adornedElement)
{
_visualChildren = new VisualCollection(this);
//Creates the dashed rectangle around the adorned element.
BuildAdornerBorder();
//Call a helper method to initialize the Thumbs with a customized cursors.
BuildAdornerCorner(ref _topLeft, Cursors.SizeNWSE);
BuildAdornerCorner(ref _topRight, Cursors.SizeNESW);
BuildAdornerCorner(ref _bottomLeft, Cursors.SizeNESW);
BuildAdornerCorner(ref _bottomRight, Cursors.SizeNWSE);
BuildAdornerCorner(ref _middleBottom, Cursors.SizeNS);
BuildAdornerCorner(ref _middleTop, Cursors.SizeNS);
BuildAdornerCorner(ref _leftMiddle, Cursors.SizeWE);
BuildAdornerCorner(ref _rightMiddle, Cursors.SizeWE);
//Add handlers for resizing • Corners
_bottomLeft.DragDelta += HandleBottomLeft;
_bottomRight.DragDelta += HandleBottomRight;
_topLeft.DragDelta += HandleTopLeft;
_topRight.DragDelta += HandleTopRight;
//Add handlers for resizing • Sides
_middleBottom.DragDelta += HandleBottomMiddle;
_middleTop.DragDelta += HandleTopMiddle;
_leftMiddle.DragDelta += HandleLeftMiddle;
_rightMiddle.DragDelta += HandleRightMiddle;
}
示例2: FileListLookupBoxAdorner
public FileListLookupBoxAdorner(FrameworkElement adornedElement)
: base(adornedElement)
{
_adornedElement = adornedElement;
_visualChildren = new VisualCollection(this);
BuildTextBox();
}
示例3: EditBoxAdorner
private VisualCollection _visualChildren; //visual children.
#endregion Fields
#region Constructors
public EditBoxAdorner(EditBox editBox, UIElement adornedElement)
: base(adornedElement)
{
_editBox = editBox;
_visualChildren = new VisualCollection(this);
BuildTextBox();
}
示例4: VisualHost
public VisualHost()
{
_children = new VisualCollection(this);
_points = new List<Point>();
_edgePen.Freeze();
_vertexPen.Freeze();
}
示例5: AutoCompleteTextBox
public AutoCompleteTextBox()
{
controls = new VisualCollection(this);
InitializeComponent();
searchThreshold = 2; // default threshold to 2 char
// set up the key press timer
keypressTimer = new System.Timers.Timer();
keypressTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
// set up the text box and the combo box
comboBox = new ComboBox();
comboBox.IsSynchronizedWithCurrentItem = true;
comboBox.IsTabStop = false;
comboBox.SelectionChanged += new SelectionChangedEventHandler(comboBox_SelectionChanged);
textBox = new TextBox();
textBox.TextChanged += new TextChangedEventHandler(textBox_TextChanged);
textBox.VerticalContentAlignment = VerticalAlignment.Center;
controls.Add(comboBox);
controls.Add(textBox);
}
示例6: ResizeAdorner
public ResizeAdorner(UIElement adornedElement)
: base(adornedElement)
{
_visualChildren = new VisualCollection(this);
_control = new ResizeControl {DataContext = adornedElement};
_visualChildren.Add(_control);
}
示例7: AdornerLayer
/// <summary>
/// Initializes a new instance of the <see cref="AdornerLayer"/> class.
/// </summary>
/// <param name="uv">The Ultraviolet context.</param>
/// <param name="name">The element's identifying name within its namescope.</param>
public AdornerLayer(UltravioletContext uv, String name)
: base(uv, name)
{
adorners = new VisualCollection(this);
adornersStates = new List<AdornerState>();
adornersTemp = new List<Adorner>();
}
示例8: PasswordBoxHintAdorner
public PasswordBoxHintAdorner(UIElement adornedElement, string hintText, Style hintStyle, VisibilityDelegate visibilityCallback)
: base(adornedElement)
{
_visibilityCallback = visibilityCallback;
_label = new Label()
{
Content = hintText,
Style = hintStyle,
};
IsHitTestVisible = true;
Visibility = Visibility.Visible;
adornedElement.GotFocus += Invalidate;
adornedElement.LostFocus += Invalidate;
adornedElement.IsVisibleChanged += Invalidate;
_visualCollection = new VisualCollection(this);
_contentPresenter = new ContentPresenter();
_visualCollection.Add(_contentPresenter);
_contentPresenter.Content = _label;
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement);
adornerLayer?.Add(this);
IsHitTestVisible = false;
}
示例9: VisualAdorner
public VisualAdorner(FrameworkElement adornerElement, UIElement adornedElement)
: base(adornedElement) {
children = new VisualCollection(this);
child = adornerElement;
children.Add(child);
AddLogicalChild(child);
}
示例10: SelectionAdorner
public SelectionAdorner(UIElement adornedElement)
: base(adornedElement)
{
IsClipEnabled = true;
visualChildren = new VisualCollection(this);
BuildAdornerCorner();
}
示例11: HelperAdorner
// Initialize the HelperAdorner.
public HelperAdorner(UIElement adornedElement)
: base(adornedElement)
{
visualChildren = new VisualCollection(this);
adornedElement.RenderTransformOrigin = new Point(0.5, 0.5);
// Call a helper method to initialize the Thumbs
// with a customized cursors.
BuildAdornerCorner(ref topLeft, Cursors.Hand);
BuildAdornerCorner(ref topRight, Cursors.Hand);
BuildAdornerCorner(ref bottomLeft, Cursors.Hand);
BuildAdornerCorner(ref bottomRight, Cursors.Hand);
BuildAdornerCorner(ref centerTop, Cursors.Hand);
topLeft.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
topLeft.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaTopLeft);
topRight.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
topRight.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaTopRight);
bottomLeft.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
bottomLeft.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaBottomLeft);
bottomRight.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
bottomRight.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaBottomRight);
centerTop.DragDelta += new DragDeltaEventHandler(HandleCenterTop);
centerTop.DragStarted += new DragStartedEventHandler(this.RotateThumb_DragStarted);
}
示例12: ResizingAdorner
// Phương thức khởi tạo
public ResizingAdorner(UIElement adornedElement)
: base(adornedElement)
{
visualChildren = new VisualCollection(this);
// Khởi tạo các anchor point
BuildAdorner(ref topLeft, Cursors.SizeNWSE);
BuildAdorner(ref topRight, Cursors.SizeNESW);
BuildAdorner(ref bottomLeft, Cursors.SizeNESW);
BuildAdorner(ref bottomRight, Cursors.SizeNWSE);
BuildAdorner(ref middleTop, Cursors.SizeNS);
BuildAdorner(ref middleBottom, Cursors.SizeNS);
BuildAdorner(ref middleLeft, Cursors.SizeWE);
BuildAdorner(ref middleRight, Cursors.SizeWE);
// Các sự kiện tương ứng với mỗi anchor point
bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);
middleTop.DragDelta += new DragDeltaEventHandler(HandleMiddleTop);
middleBottom.DragDelta += new DragDeltaEventHandler(HandleMiddleBottom);
middleLeft.DragDelta += new DragDeltaEventHandler(HandleMiddleLeft);
middleRight.DragDelta += new DragDeltaEventHandler(HandleMiddleRight);
}
示例13: ResizeAdorner
public ResizeAdorner(PanelDesigner panelDesigner, UIElement adornedElement)
: base(adornedElement)
{
m_panelDesigner = panelDesigner;
m_panelDesigner.SelectedElementChanged += m_panelDesigner_SelectedElementChanged;
m_visualChildren = new VisualCollection(this);
m_rectangle = new Rectangle();
m_rectangle.Stroke = m_panelDesigner.SelectedElement == AdornedElement ? Brushes.CornflowerBlue : Brushes.LightBlue;
m_rectangle.StrokeThickness = 1;
m_visualChildren.Add(m_rectangle);
BuildResizeAdorner(ref m_bottom, Cursors.SizeNS);
BuildResizeAdorner(ref m_bottomLeft, Cursors.SizeNESW);
BuildResizeAdorner(ref m_bottomRight, Cursors.SizeNWSE);
BuildResizeAdorner(ref m_left, Cursors.SizeWE);
BuildResizeAdorner(ref m_right, Cursors.SizeWE);
BuildResizeAdorner(ref m_top, Cursors.SizeNS);
BuildResizeAdorner(ref m_topLeft, Cursors.SizeNWSE);
BuildResizeAdorner(ref m_topRight, Cursors.SizeNESW);
m_bottom.DragDelta += new DragDeltaEventHandler(HandleBottom);
m_bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
m_bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
m_left.DragDelta += new DragDeltaEventHandler(HandleLeft);
m_right.DragDelta += new DragDeltaEventHandler(HandleRight);
m_top.DragDelta += new DragDeltaEventHandler(HandleTop);
m_topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
m_topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);
}
示例14: AdornerContentPresenter
public AdornerContentPresenter (UIElement adornedElement)
: base(adornedElement)
{
_Visuals = new VisualCollection(this);
_ContentPresenter = new ContentPresenter();
_Visuals.Add(_ContentPresenter);
}
示例15: AutoCompleteTextBox
public AutoCompleteTextBox()
{
_controls = new VisualCollection(this);
InitializeComponent();
_autoCompletionList = new ObservableCollection<AutoCompleteEntry>();
_searchThreshold = 2; // default threshold to 2 char
// set up the key press timer
_keypressTimer = new System.Timers.Timer();
_keypressTimer.Elapsed += OnTimedEvent;
// set up the text box and the combo box
ComboBox = new ComboBox
{
IsSynchronizedWithCurrentItem = true,
IsTabStop = false
};
ComboBox.SelectionChanged += comboBox_SelectionChanged;
_textBox = new TextBox();
_textBox.TextChanged += textBox_TextChanged;
_textBox.VerticalContentAlignment = VerticalAlignment.Center;
_controls.Add(ComboBox);
_controls.Add(_textBox);
}