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

C# Forms.TrackBar类代码示例

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

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



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

示例1: EditValue

        public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value )
        {
            if( context != null && provider != null )
            {
                editorService = (IWindowsFormsEditorService)provider.GetService( typeof( IWindowsFormsEditorService ) );
                if( editorService != null )
                {
                    // Create a new trackbar and set it up.
                    TrackBar trackBar = new TrackBar();
                    trackBar.ValueChanged += new EventHandler( this.ValueChanged );
                    trackBar.MouseLeave += new EventHandler( this.MouseLeave );
                    trackBar.Minimum = 0;
                    trackBar.Maximum = 100;
                    trackBar.TickStyle = TickStyle.None;

                    // Get the low/high values.
                    PropertyDescriptor prop = context.PropertyDescriptor;
                    RangeAttribute ra = prop.Attributes[typeof( RangeAttribute )] as RangeAttribute;
                    valueLow = ra.Low;
                    valueHigh = ra.High;

                    // Set the corresponding trackbar value.
                    double percent = ( System.Convert.ToDouble( value ) - valueLow ) / ( valueHigh - valueLow );
                    trackBar.Value = (int)( 100 * percent );

                    // Show the control.
                    editorService.DropDownControl( trackBar );

                    // Here is the output value.
                    value = valueLow + ( (double)trackBar.Value / 100 ) * ( valueHigh - valueLow );
                }
            }

            return value;
        }
开发者ID:roice3,项目名称:Honeycombs,代码行数:35,代码来源:TrackBarValueEditor.cs


示例2: TrackBarPropertyTest

		public void TrackBarPropertyTest ()
		{
			TrackBar myTrackBar = new TrackBar ();
			
			// A
			Assert.AreEqual (true, myTrackBar.AutoSize, "#A1");

			// L
			Assert.AreEqual (5, myTrackBar.LargeChange, "#L1");
                	
			// M
			Assert.AreEqual (10, myTrackBar.Maximum, "#M1");
			Assert.AreEqual (0, myTrackBar.Minimum, "#M2");
			
			// O
			Assert.AreEqual (Orientation.Horizontal, myTrackBar.Orientation, "#O1");
				
			// S
			Assert.AreEqual (1, myTrackBar.SmallChange, "#S1");

			// T
			Assert.AreEqual (1, myTrackBar.TickFrequency, "#T1");
			Assert.AreEqual (TickStyle.BottomRight, myTrackBar.TickStyle, "#T2");
			Assert.AreEqual ("", myTrackBar.Text, "#T3");
			myTrackBar.Text = "New TrackBar";
			Assert.AreEqual ("New TrackBar", myTrackBar.Text, "#T4");

			// V
			Assert.AreEqual (0, myTrackBar.Value, "#V1");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:30,代码来源:TrackBarTest.cs


示例3: ToolStripLabeledTrackBar

        public ToolStripLabeledTrackBar()
            : base(new Panel())
        {
            Panel panel = (Panel) this.Control;

            Label = new Label();
            Label.Location = new Point(0, 0);

            TrackBar = new TrackBar();
            TrackBar.Location = new Point(0, Label.Bottom);

            TrackBar.AutoSize = false;
            TrackBar.TickStyle = TickStyle.None;

            // no tickstyle, make the height smaller and the width
            // a bit larger to compensate:
            TrackBar.Height = (Int32) (TrackBar.PreferredSize.Height * 0.65);
            TrackBar.Width = (Int32) (TrackBar.PreferredSize.Width * 1.25);

            // the label and panel follow the trackbar width:
            Label.Width = TrackBar.Width;
            Width = TrackBar.Width;

            panel.Controls.Add(Label);
            panel.Controls.Add(TrackBar);
        }
开发者ID:asaveliev,项目名称:GaGa,代码行数:26,代码来源:ToolStripLabeledTrackBar.cs


示例4: Form2

        public Form2()
        {
            InitializeComponent();
            f1 = new Form1();
            trackBar1 = new TrackBar();
            Controls.Add(trackBar1);
            groupBox3.Controls.Add(trackBar1);
            loca = new Point(comboBox1.Location.X, comboBox1.Location.Y);
            trackBar1.Location = loca;
            trackBar1.Size = new Size(trackBar1.Size.Width + 50, trackBar1.Size.Height - 50);
            trackBar1.TickFrequency = 10;
            trackBar1.LargeChange = 3;
            trackBar1.SmallChange = 2;
            trackBar1.Maximum = 100;
            trackBar1.Minimum = 0;
            trackBar1.TickStyle = TickStyle.BottomRight;
            this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);

            string tr = comboBox1.Text.Trim('%');
            f1.Opacity = double.Parse(tr) / 100.0;

                pl = f1.axWindowsMediaPlayer1.playlistCollection.newPlaylist("list1");//axwindowsMediaPlayer.playlistCollection.newPlaylist(myPlaylist);
            f1.axWindowsMediaPlayer1.currentPlaylist = pl;
            itemm = new List<WMPLib.IWMPMedia>();
            f1.Show();
        }
开发者ID:umar-qureshi2,项目名称:video-player,代码行数:26,代码来源:Form2.cs


示例5: Editor

		public Editor(PckImage curr)
		{
			edit = new EditorPanel(curr);
			buttons = new ButtonPanel();
			size = new TrackBar();

			size.Minimum=1;
			size.Maximum=10;

			InitializeComponent();

			Controls.Add(edit);
			Controls.Add(buttons);
			Controls.Add(size);
            
			buttons.Location = new Point(0,0);
			buttons.Width = buttons.PreferredWidth;

			size.Left=buttons.Right;
			size.Top=buttons.Top;
			edit.Top=size.Bottom;
			edit.Left=buttons.Right;

			ClientSize=new Size(buttons.PreferredWidth+edit.Editor.PreferredWidth,
								edit.Editor.PreferredHeight+size.Height);

			palView = new PalView();
			palView.Closing+=new CancelEventHandler(palClose);

			palView.PaletteIndexChanged+=new PaletteClickDelegate(edit.Editor.SelectColor);
			size.Scroll+=new EventHandler(sizeScroll);
		}
开发者ID:pmprog,项目名称:OpenXCOM.Tools,代码行数:32,代码来源:Editor.cs


示例6: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.trackBar1 = new System.Windows.Forms.TrackBar();
     ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
     this.SuspendLayout();
     //
     // trackBar1
     //
     this.trackBar1.Location = new System.Drawing.Point(12, 12);
     this.trackBar1.Minimum = 1;
     this.trackBar1.Name = "trackBar1";
     this.trackBar1.Size = new System.Drawing.Size(432, 45);
     this.trackBar1.TabIndex = 0;
     this.trackBar1.Value = 1;
     this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
     //
     // LineWidthForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(469, 66);
     this.Controls.Add(this.trackBar1);
     this.Icon = global::Diagram.Properties.Resources.ico_diagramico_forms;
     this.MaximizeBox = false;
     this.Name = "LineWidthForm";
     this.Text = "Line width";
     this.Load += new System.EventHandler(this.LineWidthForm_Load);
     ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
开发者ID:pekand,项目名称:infinite-diagram,代码行数:35,代码来源:LineWidthForm.cs


示例7: vibLab_updateStatus

 private void vibLab_updateStatus(TrackBar barfreq, TrackBar barwidth, Label lbl, ref double vfreq, ref double vwidth)
 {
     
     vfreq = Math.Max(-1 * 2 * Math.Log((101-barfreq.Value) / 100.0),0.001); //logarithmic scale
     vwidth = (barwidth.Value / 100.0) * 4 + 0.01;
     lbl.Text = Math.Round(vfreq, 3) + " ; " + Math.Round(vwidth, 3);
 }
开发者ID:Alexrerx,项目名称:yaalp,代码行数:7,代码来源:VibLab.cs


示例8: Load

        public void Load(Dictionary<string, HashSet<object>> valuerange)
        {
            this.images = Viewer.images;
            this.arguments = Global.arguments;

            // Create track bars for each argument
            trackbars.Clear();
            int argidx = -1;
            foreach(Cinema.CinemaArgument argument in arguments)
            {
                ++argidx;
                /*if(argument.values.Length <= 1)
                    continue;*/

                TrackBar newtrackbar = new TrackBar(argument, argidx, meshBorders, meshTick, meshSelection);
                newtrackbar.label = argument.label;
                trackbars.Add(newtrackbar);
            }

            /*// Create track bars for meta data value
            foreach(KeyValuePair<string, HashSet<object>> range in valuerange)
            {
                TrackBar newtrackbar = new TrackBar(range.Value.Count, meshSelection);
                newtrackbar.label = range.Key;
                trackbars.Add(newtrackbar);
            }*/
        }
开发者ID:RcSepp,项目名称:global_view,代码行数:27,代码来源:ArgumentIndex.cs


示例9: SetRangeTest

		public void SetRangeTest () 
		{
			TrackBar myTrackBar = new TrackBar ();
			myTrackBar.SetRange (2,9);
			Assert.AreEqual (9, myTrackBar.Maximum, "#setM1");
			Assert.AreEqual (2, myTrackBar.Minimum, "#setM2");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:TrackBarTest.cs


示例10: MainLayout

        public MainLayout(DockPanel panel, List<ToolStripComboBox> comboBoxes, List<ToolStripButton> buttons, TrackBar trackBar, string path)
        {
            Logger = LogManager.GetLogger(Settings.Default.ApplicationLogger);

            Panel = panel;
            ComboBoxes = comboBoxes;
            Buttons = buttons;
            TrackBar = trackBar;

            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            DockConfigPath = Path.Combine(path, Settings.Default.DockingConfigurationPath);

            TreeView = new TreeViewFrame();

            TreeView.SelectedDatabaseChanged += TreeView_SlectedDatabaseChanged;
            TreeView.PropertiesClick += TreeView_PropertiesClick;

            StepFrames = new Dictionary<TestMethod, StepFrame>();
            LogFrame = new LogFrame();

            PropertiesFrame = new PropertiesFrame();
            PropertiesFrame.Caller = TreeView;

            foreach (TestMethod method in GetTestMethods())
                StepFrames[method] = CreateStepFrame(method);
        }
开发者ID:blake2002,项目名称:DatabaseBenchmark,代码行数:28,代码来源:MainLayout.cs


示例11: GridController

        public GridController(IView<string> view, GridFieldModel model)
        {
            _view = view;
            _model = model;
            _zoomCheckbox = false;

            _view.SetController(this);
            _panel = (Panel) _view.Get("Panel");
            _trackBar = (TrackBar) _view.Get("Trackbar");
            _trackBar.Enabled = false;
            _comboBox = (ComboBox) _view.Get("ComboBox");

            float tWidth = _panel.Width/_model.Rows.GetLength(1);
            float tHeight = _panel.Height/_model.Rows.GetLength(0);
            // Doing these checks to make sure that we don't have pixels left

            _tileWidth = (_panel.Width%_model.Rows.GetLength(1) != 0 // if width%length != 0
                ? (int) tWidth++ // then set to width++
                : (int) tWidth) // else set to width
                         *_model.Rows[0, 0].Width; // finally multiply by the tile width
            _tileHeight = (_panel.Width%_model.Rows.GetLength(0) != 0
                ? (int) tHeight++
                : (int) tHeight)
                          *_model.Rows[0, 0].Height;

            // only need to draw the grid once, so we can set it as the panel's background
            _panel.BackgroundImage = PaintBackground();
            _rectangle = new Rectangle(0, 0, 50, 50);
            _buffer = new Bitmap(_panel.Width, _panel.Height);

            PopulateCombobox();
            Resize(this, null);
        }
开发者ID:SanderBouwman,项目名称:KantoorInrichting,代码行数:33,代码来源:GridController.cs


示例12: TgcFloatModifier

        public TgcFloatModifier(string varName, float minValue, float maxValue, float defaultValue) : base(varName)
        {
            this.minValue = minValue;
            this.maxValue = maxValue;

            numericUpDown = new NumericUpDown();
            numericUpDown.Size = new System.Drawing.Size(100, 20);
            numericUpDown.Margin = new Padding(0);
            numericUpDown.DecimalPlaces = 4;
            numericUpDown.Minimum = (decimal)minValue;
            numericUpDown.Maximum = (decimal)maxValue;
            numericUpDown.Value = (decimal)defaultValue;
            numericUpDown.Increment = (decimal)(2f * (maxValue - minValue) / 100f);
            numericUpDown.ValueChanged += new EventHandler(numericUpDown_ValueChanged);

            trackBar = new TrackBar();
            trackBar.Size = new System.Drawing.Size(100, 20);
            trackBar.Margin = new Padding(0);
            trackBar.Minimum = 0;
            trackBar.Maximum = 20;
            trackBar.Value = (int)((defaultValue - minValue) * 20 / (maxValue - minValue));
            trackBar.ValueChanged += new EventHandler(trackBar_ValueChanged);


            contentPanel.Controls.Add(numericUpDown);
            contentPanel.Controls.Add(trackBar);
        }
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:27,代码来源:TgcFloatModifier.cs


示例13: StartCalc

        protected override void StartCalc()
        {
			if (!tool_bar_inited){
				tool_bar_inited = true;
				ChartToolBar.AccessToolBar(tb=>
				                               {
				                                   var _tsi3 = new ToolStripButton {Text = "plot color"};
                                                   set_color_tsi(_tsi3, m_plot_color);
                                                   _tsi3.Click += button1_Click;
                                                   AddItem2ToolStrip(tb, _tsi3);

				                                   var _track = new TrackBar
				                                                    {
				                                                        Dock = DockStyle.Fill,
				                                                        Maximum = 1000,
				                                                        Minimum = 10,
				                                                        SmallChange = 10,
				                                                        Value = Length,
                                                                        Text = "Average Length"                                                                        
				                                                    };
                                                   _track.ValueChanged += _new_track;
                                                   AddItem2ToolStrip(tb, new ToolStripControlHost(_track));

                                                   AddItem2ToolStrip(tb, new ToolStripSeparator());
				                               });
			}


		}
开发者ID:earlyBirdy,项目名称:multicharts.base,代码行数:29,代码来源:_Chart_ToolBar_Example_.Indicator.CS


示例14: ColorUIWrapper

            /// <summary>
            /// Creates a new instance.
            /// </summary>
            /// <param name="colorEditor">The editor this instance belongs to.</param>
            public ColorUIWrapper(XNAColorUITypeEditor colorEditor)
            {
                Type colorUiType = typeof(ColorEditor).GetNestedType("ColorUI", BindingFlags.CreateInstance | BindingFlags.NonPublic);
                ConstructorInfo constructorInfo = colorUiType.GetConstructor(new Type[] { typeof(ColorEditor) });
                _control = (Control)constructorInfo.Invoke(new object[] { colorEditor });

                _control.BackColor = System.Drawing.SystemColors.Control;

                Panel alphaPanel = new Panel();
                alphaPanel.BackColor = System.Drawing.SystemColors.Control;
                alphaPanel.Dock = DockStyle.Right;
                alphaPanel.Width = 28;
                _control.Controls.Add(alphaPanel);

                _tbAlpha = new TrackBar();
                _tbAlpha.Orientation = Orientation.Vertical;
                _tbAlpha.Dock = DockStyle.Fill;
                _tbAlpha.TickStyle = TickStyle.None;
                _tbAlpha.Maximum = byte.MaxValue;
                _tbAlpha.Minimum = byte.MinValue;
                _tbAlpha.ValueChanged += new EventHandler(OnTrackBarAlphaValueChanged);
                alphaPanel.Controls.Add(_tbAlpha);

                _lblAlpha = new Label();
                _lblAlpha.Text = "0";
                _lblAlpha.Dock = DockStyle.Bottom;
                _lblAlpha.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                alphaPanel.Controls.Add(_lblAlpha);

                _startMethodInfo = _control.GetType().GetMethod("Start");
                _endMethodInfo = _control.GetType().GetMethod("End");
                _valuePropertyInfo = _control.GetType().GetProperty("Value");

                _control.SizeChanged += new EventHandler(OnControlSizeChanged);
            }
开发者ID:rostok,项目名称:gleed2d,代码行数:39,代码来源:XNAColorUITypeEditors.cs


示例15: TgcVertex2fModifier

        public TgcVertex2fModifier(string varName, Vector2 minValue, Vector2 maxValue, Vector2 defaultValue)
            : base(varName)
        {
            this.minValue = minValue;
            this.maxValue = maxValue;

            //numericUpDownX
            numericUpDownX = new NumericUpDown();
            numericUpDownX.Size = new System.Drawing.Size(50, 20);
            numericUpDownX.Margin = new Padding(0);
            numericUpDownX.DecimalPlaces = 4;
            numericUpDownX.Minimum = (decimal)minValue.X;
            numericUpDownX.Maximum = (decimal)maxValue.X;
            numericUpDownX.Value = (decimal)defaultValue.X;
            numericUpDownX.Increment = (decimal)(2f * (maxValue.X - minValue.X) / 100f);
            numericUpDownX.ValueChanged += new EventHandler(numericUpDownX_ValueChanged);

            //numericUpDownY
            numericUpDownY = new NumericUpDown();
            numericUpDownY.Size = new System.Drawing.Size(50, 20);
            numericUpDownY.Margin = new Padding(0);
            numericUpDownY.DecimalPlaces = 4;
            numericUpDownY.Minimum = (decimal)minValue.Y;
            numericUpDownY.Maximum = (decimal)maxValue.Y;
            numericUpDownY.Value = (decimal)defaultValue.Y;
            numericUpDownY.Increment = (decimal)(2f * (maxValue.Y - minValue.Y) / 100f);
            numericUpDownY.ValueChanged += new EventHandler(numericUpDownY_ValueChanged);

            //Panel para los dos numericUpDown
            vertexValuesPanel = new FlowLayoutPanel();
            vertexValuesPanel.Margin = new Padding(0);
            vertexValuesPanel.AutoSize = true;
            vertexValuesPanel.FlowDirection = FlowDirection.LeftToRight;

            vertexValuesPanel.Controls.Add(numericUpDownX);
            vertexValuesPanel.Controls.Add(numericUpDownY);

            //trackBarX
            trackBarX = new TrackBar();
            trackBarX.Size = new System.Drawing.Size(100, 20);
            trackBarX.Margin = new Padding(0);
            trackBarX.Minimum = 0;
            trackBarX.Maximum = 20;
            trackBarX.Value = (int)((defaultValue.X - minValue.X) * 20 / (maxValue.X - minValue.X));
            trackBarX.ValueChanged += new EventHandler(trackBarX_ValueChanged);

            //trackBarY
            trackBarY = new TrackBar();
            trackBarY.Size = new System.Drawing.Size(100, 20);
            trackBarY.Margin = new Padding(0);
            trackBarY.Minimum = 0;
            trackBarY.Maximum = 20;
            trackBarY.Value = (int)((defaultValue.Y - minValue.Y) * 20 / (maxValue.Y - minValue.Y));
            trackBarY.ValueChanged += new EventHandler(trackBarY_ValueChanged);

            contentPanel.Controls.Add(vertexValuesPanel);
            contentPanel.Controls.Add(trackBarX);
            contentPanel.Controls.Add(trackBarY);
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:59,代码来源:TgcVertex2fModifier.cs


示例16: ToolStripLabeledTrackBar

        public ToolStripLabeledTrackBar()
            : base(new LabeledTrackBar())
        {
            LabeledTrackBar control = (LabeledTrackBar) this.Control;

            Label = control.label;
            TrackBar = control.trackbar;
        }
开发者ID:joshimoo,项目名称:GaGa,代码行数:8,代码来源:ToolStripLabeledTrackBar.cs


示例17: CreateControlInstance

 private static Control CreateControlInstance()
 {
     TrackBar tb = new TrackBar();
       tb.AutoSize = false;
       tb.Size = new Size(60, 24);
       // Add other initialization code here.
       return tb;
 }
开发者ID:romanbdev,项目名称:quickroute-gps,代码行数:8,代码来源:ToolstripTrackBar.cs


示例18: DeadZoneControlsLink

 public DeadZoneControlsLink(TrackBar trackBar, NumericUpDown numericUpDown, TextBox textBox)
 {
     _TrackBar = trackBar;
     _NumericUpDown = numericUpDown;
     _TextBox = textBox;
     _TrackBar.ValueChanged += _TrackBar_ValueChanged;
     _NumericUpDown.ValueChanged += _NumericUpDown_ValueChanged;
 }
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:8,代码来源:DeadZoneControlsLink.cs


示例19: SyncValue

        private void SyncValue(NumericUpDown number, TrackBar trackbar)
        {
            int value = Convert.ToInt32(number.Value);
            if (value == trackbar.Value) return;

            number.Value = trackbar.Value;
            UpdateColor();
        }
开发者ID:jgera,项目名称:FerretLib.WinForms,代码行数:8,代码来源:ColorPicker.cs


示例20: SlowMethod

 public void SlowMethod(NumericUpDown nud, ProgressBar progBar, TrackBar trackBar)
 {
     for (int i = 0; i < 10; i++)
        {
        System.Threading.Thread.Sleep(500);
        OnUpdateEvent(nud,progBar,trackBar);
        }
 }
开发者ID:dec-k,项目名称:IN710-keigdl1,代码行数:8,代码来源:ProgressSubject.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Forms.TreeNode类代码示例发布时间:2022-05-26
下一篇:
C# Forms.ToolTip类代码示例发布时间: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