当前位置: 首页>>代码示例>>C#>>正文


C# Controls.Slider类代码示例

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


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


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