本文整理汇总了C#中VisualCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# VisualCollection.Add方法的具体用法?C# VisualCollection.Add怎么用?C# VisualCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualCollection
的用法示例。
在下文中一共展示了VisualCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: SOMVisual
public SOMVisual(SOMVisualType type, int size, int width, int height, PictureSOM.SOM s)
{
_visualType = type;
_boardSize = PictureSOM.SOMConstants.NUM_NODES_ACROSS; // assuming that across and down are the same
_boardWidthFactor = (width - (2 * _border)) / size;
_boardHeightFactor = (height - (2 * _border)) / size;
_som = s;
_children = new VisualCollection(this);
DrawBoard();
_children.Add(_boardDrawingVisual); // Render the grid
if (_visualType == SOMVisualType.COMPETITION_LAYER_MAP)
{
CreateDrawingVisual_Text(s);
}
else if(_visualType == SOMVisualType.COMPETITION_LAYER_MAP_FIXED)
{
CreateDrawingVisual_Text_Fixed(s);
}
else if (_visualType == SOMVisualType.ERROR_MAP)
{
CreateDrawingVisual_ErrorMap(s);
}
_children.Add(_drawingVisual);
// Add the event handler for MouseLeftButtonUp.
this.MouseLeftButtonUp += new MouseButtonEventHandler(SOMVisual_MouseLeftButtonUp);
}
示例4: MyCanvasAdorner
public MyCanvasAdorner(UIElement adorned)
: base(adorned)
{
visCollec = new VisualCollection(this);
visCollec.Add(tl = GetResizeThumb(Cursors.SizeNWSE, HorizontalAlignment.Left, VerticalAlignment.Top));
visCollec.Add(tr = GetResizeThumb(Cursors.SizeNESW, HorizontalAlignment.Right, VerticalAlignment.Top));
visCollec.Add(bl = GetResizeThumb(Cursors.SizeNESW, HorizontalAlignment.Left, VerticalAlignment.Bottom));
visCollec.Add(br = GetResizeThumb(Cursors.SizeNWSE, HorizontalAlignment.Right, VerticalAlignment.Bottom));
visCollec.Add(mov = GetMoveThumb());
}
示例5: ModelOperationAdorner
public ModelOperationAdorner(ModelItem adorned)
: base(adorned)
{
collection = new VisualCollection(this);
collection.Add(tl = GetResizeThumb("LT"));
collection.Add(tr = GetResizeThumb("RT"));
collection.Add(bl = GetResizeThumb("LB"));
collection.Add(br = GetResizeThumb("RB"));
collection.Add(handler = GetMoveThumb());
}
示例6: CustomVisualFrameworkElement
public CustomVisualFrameworkElement()
{
// Fill the VisualCollection with a few DrawingVisual objects.
theVisuals = new VisualCollection(this);
theVisuals.Add(AddRect());
theVisuals.Add(AddCircle());
// Handle the MouseDown event.
this.MouseDown += MyVisualHost_MouseDown;
}
示例7: MyVisualHost
public MyVisualHost()
{
_children = new VisualCollection(this);
_children.Add(CreateDrawingVisualRectangle());
_children.Add(CreateDrawingVisualText());
_children.Add(CreateDrawingVisualEllipses());
// Add the event handler for MouseLeftButtonUp.
this.MouseLeftButtonUp += new MouseButtonEventHandler(MyVisualHost_MouseLeftButtonUp);
}
示例8: LayoutVisualHost
public LayoutVisualHost(double width, double height, int curBatch, bool anotherRun)
{
this.width = width;
this.height = height;
backOffset = (height - 20) / 8.0;
frontOffset = (height - 20) / 4.0;
spotHeight = (height - backOffset - frontOffset) / 9.0;
spotWidth = spotHeight / 3.0;
_children = new VisualCollection(this);
_children.Add(CreateDarkSpots());
_children.Add(CreateRacks(curBatch,anotherRun));
}
示例9: VisualAdorner
public VisualAdorner(FrameworkElement adornerElement, UIElement adornedElement)
: base(adornedElement) {
children = new VisualCollection(this);
child = adornerElement;
children.Add(child);
AddLogicalChild(child);
}
示例10: 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;
}
示例11: ElementAdorner
public ElementAdorner(UIElement adornedElement, IControlBox controlBox)
: base(adornedElement)
{
visualChildren = new VisualCollection(this);
FrameworkElement box = controlBox as FrameworkElement;
this.controlBox = box;
panel.Children.Add(box);
panel.Orientation = Orientation.Vertical;
visualChildren.Add(panel);
// Call a helper method to initialize the Thumbs
// with a customized cursors.
BuildAdornerCorner(ref resizeThumb, Cursors.SizeNWSE);
// Add handlers for resizing.
resizeThumb.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
this.ProcessControlBox(controlBox);
this.MouseEnter += new MouseEventHandler(adornedElement_MouseEnter);
this.MouseLeave += new MouseEventHandler(adornedElement_MouseLeave);
this.AdornedElement.MouseEnter += new MouseEventHandler(adornedElement_MouseEnter);
this.AdornedElement.MouseLeave += new MouseEventHandler(adornedElement_MouseLeave);
this.Opacity = 0;
}
示例12: AdornerContentPresenter
public AdornerContentPresenter (UIElement adornedElement)
: base(adornedElement)
{
_Visuals = new VisualCollection(this);
_ContentPresenter = new ContentPresenter();
_Visuals.Add(_ContentPresenter);
}
示例13: ResizeAdorner
public ResizeAdorner(UIElement adornedElement)
: base(adornedElement)
{
_visualChildren = new VisualCollection(this);
_control = new ResizeControl {DataContext = adornedElement};
_visualChildren.Add(_control);
}
示例14: WaveFormVisual
public WaveFormVisual()
{
maxPoints = new List<Point>();
minPoints = new List<Point>();
_children = new VisualCollection(this);
_children.Add(CreateWaveFormVisual());
}
示例15: 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);
}