• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.Slider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Controls.Slider的典型用法代码示例。如果您正苦于以下问题:C# Slider类的具体用法?C# Slider怎么用?C# Slider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Slider类属于System.Windows.Controls命名空间,在下文中一共展示了Slider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AttachControl

        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            Grid grid = new Grid();
            int rowIndex = 0;

            TextBlock brightnessText = new TextBlock();
            brightnessText.Text = "Threshold";
            Grid.SetRow(brightnessText, rowIndex++);

            Slider brightnessSlider = new Slider();
            brightnessSlider.Minimum = 0.0;
            brightnessSlider.Maximum = 1.0;
            brightnessSlider.Value = _colorSwapFilter.Threshold;
            brightnessSlider.ValueChanged += brightnessSlider_ValueChanged;
            Grid.SetRow(brightnessSlider, rowIndex++);


            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(brightnessText);
            grid.Children.Add(brightnessSlider);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
开发者ID:sachin4203,项目名称:ClassicPhotoEditor,代码行数:32,代码来源:MynewFilter3.cs


示例2: AttachControl

        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            var grid = new Grid();
            int rowIndex = 0;

            TextBlock levelText = new TextBlock()
            {
                Text = "Level"
            };
            Grid.SetRow(levelText, rowIndex++);

            Slider levelSlider = new Slider() { Minimum = 0.0, Maximum = 1.0, Value = _filter.Level};
            levelSlider.ValueChanged += levelSlider_ValueChanged;
            Grid.SetRow(levelSlider, rowIndex++);

            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(levelText);
            grid.Children.Add(levelSlider);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
开发者ID:KayNag,项目名称:LumiaImagingSDKSample,代码行数:30,代码来源:EmbossWrapperFilter.cs


示例3: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.FontSizeSlider = ((System.Windows.Controls.Slider)(target));
     return;
     case 2:
     
     #line 10 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ToSmall);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 11 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ToMiddle);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 12 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ToLarge);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:krstan4o,项目名称:TelerikAcademy,代码行数:33,代码来源:MainWindow.g.cs


示例4: setObjects

 public void setObjects(Type ShapeType, StackPanel dp)
 {
     Elements.Clear();
     dp.Children.Clear();
     if(ShapeType == typeof(GoodStar))
     {
         dp.Children.Add(new TextBlock() { Text = "Tops Count: " });
        // dp.Children.Add(new TextBox() { Name= "topsCount",Width = 30 });
         Slider tops = new Slider() { Name = "topsCount", Value =5, Minimum = 1, Maximum = 30, SmallChange = 1, LargeChange = 1, Width = 100 };
         tops.ValueChanged += tops_ValueChanged;
         dp.Children.Add(tops);
         dp.Children.Add(new TextBlock() { Text = "Coeficient: " });
         Slider coef = new Slider() { Name = "Coefficient",Value = 0.5, Minimum = 0.01, Maximum = 1, SmallChange = 0.01, LargeChange = 0.1, Width = 100 };
         coef.ValueChanged += coef_ValueChanged;
         dp.Children.Add(coef);
     }
     if(ShapeType == typeof(GoodPolygon))
     {
         dp.Children.Add(new TextBlock() { Name= "topsCount", Text = "Tops Count: " });
         Slider tops = new Slider() { Name = "topsCount", Value = 5, Minimum = 1, Maximum = 30, SmallChange = 1, LargeChange = 1, Width = 100 };
         tops.ValueChanged += tops_ValueChanged;
         dp.Children.Add(tops);
     }
     if(ShapeType == typeof(GoodRectangle))
     {
         dp.Children.Add(new TextBlock() { Text = "X radius: " });
         Slider xRadius = new Slider() { Name = "xRadius", Value = 0, Minimum = 0, Maximum = 90, SmallChange = 1, LargeChange = 1, Width = 100 };
         xRadius.ValueChanged += Angle_ValueChanged;
         dp.Children.Add(xRadius);
         dp.Children.Add(new TextBlock() { Text = "Y radius: " });
         Slider yRadius = new Slider() { Name = "yRadius", Value = 0, Minimum = 0, Maximum = 90, SmallChange = 1, LargeChange = 1, Width = 100 };
         yRadius.ValueChanged += Angle_ValueChanged;
         dp.Children.Add(yRadius);
     }
 }
开发者ID:goodmaker,项目名称:gooddrawer,代码行数:35,代码来源:ShapeInfoManager.cs


示例5: SliderExtensions

 private SliderExtensions(Slider attachedObject)
 {
     this.element = attachedObject as Slider;
     this.element.AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(element_MouseLeftButtonDown), true);
     this.element.MouseMove += new MouseEventHandler(element_MouseMove);
     this.element.MouseLeftButtonUp += new MouseButtonEventHandler(element_MouseLeftButtonUp);
 }
开发者ID:Titaye,项目名称:SLExtensions,代码行数:7,代码来源:SliderExtensions.cs


示例6: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.sliderElement = base.GetTemplateChild("ZoomSlider") as Slider;
            this.zoomInElement = base.GetTemplateChild("ZoomInElement") as RepeatButton;
            this.zoomOutElement = base.GetTemplateChild("ZoomOutElement") as RepeatButton;

            this.SetupZoom();

            if (this.sliderElement != null)
            {
                sliderElement.MouseEnter += new MouseEventHandler(zoomSliderElement_MouseEnter);
                sliderElement.MouseLeave += new MouseEventHandler(zoomSliderElement_MouseLeave);

                this.sliderElement.ValueChanged += new RoutedPropertyChangedEventHandler<double>(this.ZoomSlider_ValueChanged);
            }
            if (this.zoomInElement != null)
            {
                this.zoomInElement.Click += new RoutedEventHandler(this.ZoomInButton_Click);
            }
            if (this.zoomOutElement != null)
            {
                this.zoomOutElement.Click += new RoutedEventHandler(this.ZoomOutButton_Click);
            }
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:26,代码来源:CustomZoomSlider.xaml.cs


示例7: Creation

		public void Creation ()
		{
			Slider p = new Slider ();
			p.Measure (new Size (double.PositiveInfinity, double.PositiveInfinity));
			Assert.AreEqual (p.DesiredSize.Width, 0, "DesiredSize.Width");
			Assert.AreEqual (p.DesiredSize.Height, 0, "DesiredSize.Height");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:7,代码来源:SliderTest.cs


示例8: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_panelOffscreenOffsetX = DefaultOffscreenOffsetX;

            m_floorSlider = GetTemplateChild("FloorSlider") as Slider;
            m_floorSlider.ValueChanged += OnSliderValueChanged;

            m_floorSlider.ApplyTemplate();

            m_sliderTickBar = GetTickBar(m_floorSlider);

            var sliderThumb = GetThumb(m_floorSlider);

            sliderThumb.DragStarted += OnSliderDragStarted;
            sliderThumb.DragCompleted += OnSliderDragCompleted;

            m_floorName = (TextBlock)GetTemplateChild("FloorName");

            m_dismissButton = (Button)GetTemplateChild("DismissButton");
            m_dismissButton.Click += OnClickDismiss;

            m_floorPanel = (Grid)GetTemplateChild("FloorPanel");

            m_detailsPanel = (Grid)GetTemplateChild("DetailsPanel");

            m_detailsPanel.Opacity = 0.0f;
            var currentPosition = m_floorPanel.RenderTransform.Transform(new Point(0.0, 0.0));
            m_floorPanel.RenderTransform = new TranslateTransform(m_panelOffscreenOffsetX, currentPosition.Y);
        }
开发者ID:testaccount109,项目名称:mobile-example-app,代码行数:31,代码来源:InteriorsExplorerView.cs


示例9: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (ScrollViewer == null)
                return;

            BindedCanvas = f_designerCanvas = ((Canvas)ScrollViewer.Content).Children[0] as Canvas;
            f_designerCanvas = ScrollViewer.Content as Canvas;
            if (f_designerCanvas == null)
                throw new Exception("Canvas must not be null!");

            //f_zoomThumb = Template.FindName("PART_ZoomThumb", this) as Thumb;
            //if (f_zoomThumb == null)
            //    throw new Exception("PART_ZoomThumb template is missing!");

            f_zoomCanvas = Template.FindName("PART_ZoomCanvas", this) as Canvas;
            if (f_zoomCanvas == null)
                throw new Exception("PART_ZoomCanvas template is missing!");

            f_zoomSlider = Template.FindName("PART_ZoomSlider", this) as Slider;
            if (f_zoomSlider == null)
                throw new Exception("PART_ZoomSlider template is missing!");

            f_designerCanvas.LayoutUpdated += DesignerCanvas_LayoutUpdated;

            //f_zoomThumb.DragDelta += Thumb_DragDelta;

            f_zoomSlider.ValueChanged += ZoomSlider_ValueChanged;

            f_scaleTransform = new ScaleTransform();
            f_designerCanvas.LayoutTransform = f_scaleTransform;
        }
开发者ID:msCube,项目名称:Gallery,代码行数:33,代码来源:ZoomBox.cs


示例10: 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;
        }
开发者ID:jgkim999,项目名称:WpfExample,代码行数:32,代码来源:ZoomBox.cs


示例11: ReadOnlyProperties

		public void ReadOnlyProperties ()
		{
			Slider s = new Slider ();
			Assert.Throws<InvalidOperationException> (delegate {
				s.SetValue (Thumb.IsFocusedProperty, true);
			}, "IsFocusedProperty");
		}
开发者ID:dfr0,项目名称:moon,代码行数:7,代码来源:SliderTest.cs


示例12: 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;
            }
        }
开发者ID:naimheshmati,项目名称:Sanofi,代码行数:29,代码来源:ZoomSliderControl.cs


示例13: ColorMixerVIewModel

 public ColorMixerVIewModel(Slider red, Slider green, Slider blue)
 {
     CurrentColor = "Click me";
     selector = new Selector(red, green, blue);
     clickMeCommand=new ClickMeCommand(selector);
     selector.ColorChanged += selector_ColorChanged;
     selector.CurrentColor += selector_CurrentColor;
 }
开发者ID:denmerc,项目名称:Presentations,代码行数:8,代码来源:ColorMixerVIewModel.cs


示例14: Initialize

		public void Initialize (Orientation dir)
		{
			Widget = new System.Windows.Controls.Slider () {
				Orientation = dir == Orientation.Horizontal ? SWC.Orientation.Horizontal : SWC.Orientation.Vertical,
			};
			Widget.MouseWheel += HandleMouseWheel;
			Slider.ValueChanged += ValueChanged;
		}
开发者ID:m13253,项目名称:xwt,代码行数:8,代码来源:SliderBackend.cs


示例15: ApplyDefaultStyle

		public void ApplyDefaultStyle ()
		{
			// Default style is applied when the element is added to the visual tree
			Slider s = new Slider ();
			Assert.AreEqual (1, s.Maximum, "#1");
			TestPanel.Children.Add (s);
			Assert.AreEqual (10, s.Maximum, "#2");
		}
开发者ID:kangaroo,项目名称:moon,代码行数:8,代码来源:StyleTest.cs


示例16: Create

			public static AbsRelSpeed Create(PtzAxis ax, PtzView view, Slider slider) {
				AbsRelSpeed res = null;
				do {
					var spdInf = GetSpeedInfo(view)[ax];
					if (spdInf == null) {
						break;
					}
					var range = spdInf.Item1;
					if (range == null) {
						break;
					}
					var def = spdInf.Item2;
					if (range == null) {
						break;
					}
					if (float.IsNaN(def)) {
						break;
					}
					var min = range.min;
					var max = range.max;
					if (float.IsNaN(min) || float.IsNaN(max) || min > max) {
						break;
					}
					if (float.IsNegativeInfinity(min)) {
						min = float.MinValue;
					}
					if (float.IsPositiveInfinity(max)) {
						max = float.MaxValue;
					}
					if (def > max || def < min) {
						res = new AbsRelSpeed(def, def, def);
						break;
					}
					res = new AbsRelSpeed(min, max, def);
					if (slider != null) {
						slider.Minimum = min;
						slider.Maximum = max;
						slider.SmallChange = (max - min) / 100f;
						slider.LargeChange = (max - min) / 10f;
						slider.Value = def;
						slider.Visibility = Visibility.Visible;
						if (min != max) {
							slider.IsEnabled = true;
							slider.ValueChanged += (s, a) => {
								res.val = res.rng.Coerce((float)a.NewValue);
							};
						} else {
							slider.IsEnabled = false;
						}
					}
					return res;
				} while (false);

				if (slider != null) {
					slider.Visibility = Visibility.Collapsed;
				}
				return res;
			}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:58,代码来源:PtzView.AbsRelSpeed.cs


示例17: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.mySlider = ((System.Windows.Controls.Slider)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:zkhadikov,项目名称:wpf_course,代码行数:9,代码来源:MainWindow.g.i.cs


示例18: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/MoodTracker;component/UserControls/CustomeSlider.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.UC_Slider = ((System.Windows.Controls.Slider)(this.FindName("UC_Slider")));
 }
开发者ID:vaibhavb,项目名称:moodtracker,代码行数:9,代码来源:CustomeSlider.g.i.cs


示例19: OnClick

 void OnClick(object sender, RoutedEventArgs e)
 {
   cv1.Children.Clear();
   //Slider Orientation="Horizontal" hslider = new Slider Orientation="Horizontal"();
   Slider hslider = new Slider();
   hslider.Orientation = Orientation.Horizontal;
   hslider.Width = 100;
   cv1.Children.Add(hslider);
 }
开发者ID:julid29,项目名称:confsamples,代码行数:9,代码来源:slider_samp.xaml.cs


示例20: Properties

		public void Properties ()
		{
			Slider s = new Slider ();
			// default properties on Slider
			s.IsDirectionReversed = !s.IsDirectionReversed;

			Assert.AreEqual (Orientation.Horizontal, s.Orientation, "Orientation");
			s.Orientation = (Orientation) Int32.MaxValue;
			Assert.AreEqual ((Orientation) Int32.MaxValue, s.Orientation, "MaxValue");
		}
开发者ID:dfr0,项目名称:moon,代码行数:10,代码来源:SliderTest.cs



注:本文中的System.Windows.Controls.Slider类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.StackPanel类代码示例发布时间:2022-05-26
下一篇:
C# Controls.Separator类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap