本文整理汇总了C#中System.Windows.Controls.Primitives.Thumb类的典型用法代码示例。如果您正苦于以下问题:C# Thumb类的具体用法?C# Thumb怎么用?C# Thumb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Thumb类属于System.Windows.Controls.Primitives命名空间,在下文中一共展示了Thumb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildAdornerCorner
private Thumb BuildAdornerCorner(Cursor cursor, DragDeltaEventHandler dragHandler)
{
var thumb = new Thumb();
// TODO: this thumb should be styled to look like a dotted triangle,
// similar to the one you can see on the bottom right corner of
// Internet Explorer window
thumb.Cursor = cursor;
thumb.Height = thumb.Width = 10;
thumb.Opacity = 0.40;
thumb.Background = new SolidColorBrush(Colors.MediumBlue);
thumb.DragDelta += dragHandler;
thumb.DragStarted += (s, e) =>
{
var handler = ResizeStarted;
if (handler != null)
{
handler(this, e);
}
};
thumb.DragCompleted += (s, e) =>
{
var handler = ResizeCompleted;
if (handler != null)
{
handler(this, e);
}
};
_visualChildren.Add(thumb);
return thumb;
}
示例2: ZoomSliderControl
public ZoomSliderControl(BIT.AVL.Silver.Map.Map map)
{
_Map = map;
DefaultStyleKey = typeof(ZoomSliderControl);
if(HtmlPage.IsEnabled)
{
_Thumb = new Thumb();
_Slider = this;
// Slider Events
_Slider.GotFocus += Slider_GotFocus;
_Slider.LostFocus += Slider_LostFocus;
_Slider.ValueChanged += ZoomControl_ValueChanged;
// Map Events
_Map.Events.MapMouseEnter += Events_MapMouseEnter;
_Map.Events.MapMouseLeave += Events_MapMouseLeave;
_Map.Events.MapZoomStarted += Events_MapZoomStarted;
_Map.Events.MapZoomEnded += Events_MapZoomEnded;
_Map.Events.MapZoomChanged += Events_MapZoomChanged;
_Map.Events.MapMouseWheel += Events_MapMouseWheel;
_Map.Events.MapDoubleClick += Events_MapDoubleClick;
_Map.Events.MapTileSourceChanged += Events_MapTileSourceChanged;
SetTileSourceZoomLevels();
_UpdateSlider = true;
}
}
示例3: OnApplyTemplate
/// <internalonly />
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_horizontalThumb = GetTemplateChild("HorizontalThumb") as Thumb;
_verticalThumb = GetTemplateChild("VerticalThumb") as Thumb;
FrameworkElement leftTracker = GetTemplateChild("LeftTrack") as FrameworkElement;
FrameworkElement rightTracker = GetTemplateChild("RightTrack") as FrameworkElement;
if (leftTracker != null) {
leftTracker.MouseLeftButtonDown += OnHorizontalTrackerMouseDown;
}
if (rightTracker != null) {
rightTracker.MouseLeftButtonDown += OnHorizontalTrackerMouseDown;
}
FrameworkElement topTracker = GetTemplateChild("TopTrack") as FrameworkElement;
FrameworkElement bottomTracker = GetTemplateChild("BottomTrack") as FrameworkElement;
if (topTracker != null) {
topTracker.MouseLeftButtonDown += OnVerticalTrackerMouseDown;
}
if (bottomTracker != null) {
bottomTracker.MouseLeftButtonDown += OnVerticalTrackerMouseDown;
}
}
示例4: OnApplyTemplate
public override void OnApplyTemplate() {
base.OnApplyTemplate();
if (_thumb != null) {
_thumb.DragDelta -= Thumb_DragDelta;
_thumb.DragStarted -= Thumb_DragStarted;
_thumb.DragCompleted -= Thumb_DragCompleted;
}
if (_wrapper != null) {
_wrapper.MouseWheel -= Wrapper_MouseWheel;
}
_thumb = GetTemplateChild(@"PART_Thumb") as Thumb;
_wrapper = GetTemplateChild(@"PART_Wrapper") as FrameworkElement;
if (_thumb != null) {
_thumb.DragDelta += Thumb_DragDelta;
_thumb.DragStarted += Thumb_DragStarted;
_thumb.DragCompleted += Thumb_DragCompleted;
}
if (_wrapper != null) {
_wrapper.MouseWheel += Wrapper_MouseWheel;
}
}
示例5: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
Thumb left = GetTemplateChild("PART_LeftResizer") as Thumb;
if (left != null)
{
PART_LeftResizer = left;
PART_LeftResizer.DragDelta += Resizer_DragDelta;
//PART_LeftResizer.MouseDown += (s,e) => Kernel.RunMxs("disableSceneRedraw()");
//PART_LeftResizer.MouseUp += (s, e) => Kernel.RunMxs("enableSceneRedraw()");
PART_LeftResizer.MouseUp += (s, e) => Width = PART_ResizeIndicator.ActualWidth;
}
Thumb right = GetTemplateChild("PART_RightResizer") as Thumb;
if (right != null)
{
PART_RightResizer = right;
PART_RightResizer.DragDelta += Resizer_DragDelta;
PART_RightResizer.MouseUp += (s, e) => Width = PART_ResizeIndicator.ActualWidth;
}
Rectangle rect = GetTemplateChild("PART_ResizeIndicator") as Rectangle;
if (rect != null)
{
PART_ResizeIndicator = rect;
}
}
示例6: OnApplyTemplate
public override void OnApplyTemplate() {
dragThumb = (Thumb) Template.FindName("PART_DragThumb", this);
dragThumb.DragDelta += DragThumbOnDragDelta;
base.OnApplyTemplate();
}
示例7: DefaultMethods
public void DefaultMethods ()
{
Thumb t = new Thumb ();
t.CancelDrag ();
t.OnApplyTemplate ();
ControlTest.CheckDefaultMethods (t);
}
示例8: ConnectByArrow
/// <summary>
/// Creates an arrow (line and head) and connects two Thumbs in the given canvas
/// </summary>
/// <param name="canvas"></param>
/// <param name="startElement"></param>
/// <param name="destinationElement"></param>
/// <param name="headWidth"></param>
/// <param name="headHeight"></param>
/// <author>Krystian Zielonka,Thomas Meents</author>
protected void ConnectByArrow(Canvas canvas, Thumb startElement, Thumb destinationElement, int headWidth = 10,
int headHeight = 4)
{
// Create the arrow
Arrow arrow = new Arrow(startElement, destinationElement)
{
HeadWidth = headWidth,
HeadHeight = headHeight,
Stroke = Settings.Default.DefaultStrokeColor,
StrokeThickness = Settings.Default.DefaultStrokeThickness
};
Binding x1 = new Binding();
Binding x2 = new Binding();
Binding y1 = new Binding();
Binding y2 = new Binding();
x1.Path = new PropertyPath(Canvas.LeftProperty);
x2.Path = new PropertyPath(Canvas.LeftProperty);
y1.Path = new PropertyPath(Canvas.TopProperty);
y2.Path = new PropertyPath(Canvas.TopProperty);
x1.Source = startElement;
y1.Source = startElement;
x2.Source = destinationElement;
y2.Source = destinationElement;
arrow.SetBinding(Arrow.X1Property, x1);
arrow.SetBinding(Arrow.Y1Property, y1);
arrow.SetBinding(Arrow.X2Property, x2);
arrow.SetBinding(Arrow.Y2Property, y2);
// Add the arrow to the canvas
canvas.Children.Add(arrow);
}
示例9: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (this.ScrollViewer == null)
return;
this.designerCanvas = this.ScrollViewer.Content as DesignerCanvas;
if (this.designerCanvas == null)
throw new Exception("DesignerCanvas must not be null!");
this.zoomThumb = Template.FindName("PART_ZoomThumb", this) as Thumb;
if (this.zoomThumb == null)
throw new Exception("PART_ZoomThumb template is missing!");
this.zoomCanvas = Template.FindName("PART_ZoomCanvas", this) as Canvas;
if (this.zoomCanvas == null)
throw new Exception("PART_ZoomCanvas template is missing!");
this.zoomSlider = Template.FindName("PART_ZoomSlider", this) as Slider;
if (this.zoomSlider == null)
throw new Exception("PART_ZoomSlider template is missing!");
this.designerCanvas.LayoutUpdated += new EventHandler(this.DesignerCanvas_LayoutUpdated);
this.zoomThumb.DragDelta += new DragDeltaEventHandler(this.Thumb_DragDelta);
this.zoomSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(this.ZoomSlider_ValueChanged);
this.scaleTransform = new ScaleTransform();
this.designerCanvas.LayoutTransform = this.scaleTransform;
}
示例10: OnApplyTemplate
public override void OnApplyTemplate() {
base.OnApplyTemplate();
_mThumb = GetTemplateChild("PART_Thumb") as Thumb;
if (_mThumb == null) return;
UpdateThumbPosition();
_mThumb.RenderTransform = _mThumbTransform;
}
示例11: BuildResizeThumb
void BuildResizeThumb(Style thumbStyle)
{
if (_cornerThumb == null)
{
_cornerThumb = new Thumb { Style = thumbStyle };
_visualChildren.Add(_cornerThumb);
}
}
示例12: CompleteSinkMove
private void CompleteSinkMove(Thumb thumb, DragCompletedEventArgs e)
{
var sink = thumb.DataContext as SinkViewModel;
if (sink == null)
return;
sink.UpdateSinkPosition();
}
示例13: OnApplyTemplate
public override void OnApplyTemplate()
{
thumb = GetTemplateChild("PART_Thumb") as Thumb;
thumb.DragDelta += new DragDeltaEventHandler(thumb_DragDelta);
base.OnApplyTemplate();
}
示例14: CompleteNodeMove
private void CompleteNodeMove(Thumb thumb, DragCompletedEventArgs e)
{
var node = thumb.DataContext as NodeElementViewModel;
if (node == null)
return;
node.UpdateNodePosition();
}
示例15: RotateThumbExtension
public RotateThumbExtension()
{
adornerPanel = new AdornerPanel();
adornerPanel.Order = AdornerOrder.Foreground;
this.Adorners.Add(adornerPanel);
thumb = CreateRotateThumb();
}