當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.ScrollBar類代碼示例

本文整理匯總了C#中System.Windows.Forms.ScrollBar的典型用法代碼示例。如果您正苦於以下問題:C# ScrollBar類的具體用法?C# ScrollBar怎麽用?C# ScrollBar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScrollBar類屬於System.Windows.Forms命名空間,在下文中一共展示了ScrollBar類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HeapLayoutView

        public HeapLayoutView()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
                ControlStyles.Opaque | ControlStyles.ResizeRedraw |
                ControlStyles.Selectable,
                true
            );

            BackColor = SystemColors.Window;
            ForeColor = SystemColors.WindowText;

            ScrollBar = new VScrollBar {
                SmallChange = 1,
                LargeChange = 8,
                TabStop = false
            };

            NextAllocationButton = new Button {
                Text = ">",
                TabStop = false,
                UseVisualStyleBackColor = true
            };
            NextAllocationButton.Click += NextAllocationButton_Click;

            ScrollBar.Scroll += ScrollBar_Scroll;
            OnResize(EventArgs.Empty);

            Controls.Add(ScrollBar);
            Controls.Add(NextAllocationButton);
        }
開發者ID:konlil,項目名稱:HeapProfiler,代碼行數:31,代碼來源:HeapLayoutView.cs

示例2: AdjustScrollbar

 /// <summary>
 /// This method for System.Windows.Forms.ScrollBar and inherited classes
 /// </summary>
 private void AdjustScrollbar(ScrollBar scrollBar, int max, int value, int clientSize)
 {
     scrollBar.LargeChange = clientSize / 3;
     scrollBar.SmallChange = clientSize / 11;
     scrollBar.Maximum = max + scrollBar.LargeChange;
     scrollBar.Visible = max > 0;
     scrollBar.Value = Math.Min(scrollBar.Maximum, value);
 }
開發者ID:GeekOfWires,項目名稱:FastColoredTextBox,代碼行數:11,代碼來源:CustomScrollBarsSample.cs

示例3: SetScrollbar

        public void SetScrollbar(ScrollBar bar)
        {
            scrollbar = bar;
            scrollbar.ValueChanged += (o, e) => invalidateScrollbar();
            scrollbar.Scroll += (o, e) => invalidateScrollbar();

            if (tileSet != null)
                invalidateScrollbar();
        }
開發者ID:MyEyes,項目名稱:Igorr,代碼行數:9,代碼來源:TileSelecter.cs

示例4: TabControl

 public TabControl(DockStyle dockStyle, AnchorAlignment stripAnchor)
 {
     if ((dockStyle == DockStyle.Fill) || (dockStyle == DockStyle.None))
     {
         throw new ArgumentException(DR.GetString("InvalidDockingStyle", new object[] { "dockStyle" }));
     }
     base.SuspendLayout();
     this.stripAnchor = stripAnchor;
     this.Dock = dockStyle;
     this.allowDockChange = false;
     if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right))
     {
         base.Width = SystemInformation.VerticalScrollBarWidth + 2;
         this.splitter = new Splitter();
         this.tabStrip = new System.Workflow.ComponentModel.Design.TabStrip(Orientation.Vertical, SystemInformation.VerticalScrollBarWidth);
         this.scrollBar = new VScrollBar();
         if (this.stripAnchor == AnchorAlignment.Near)
         {
             this.tabStrip.Dock = DockStyle.Top;
             this.splitter.Dock = DockStyle.Top;
             this.scrollBar.Dock = DockStyle.Fill;
         }
         else
         {
             this.tabStrip.Dock = DockStyle.Bottom;
             this.splitter.Dock = DockStyle.Bottom;
             this.scrollBar.Dock = DockStyle.Fill;
         }
     }
     else
     {
         base.Height = SystemInformation.HorizontalScrollBarHeight + 2;
         this.splitter = new Splitter();
         this.tabStrip = new System.Workflow.ComponentModel.Design.TabStrip(Orientation.Horizontal, SystemInformation.HorizontalScrollBarHeight);
         this.scrollBar = new HScrollBar();
         if (this.stripAnchor == AnchorAlignment.Near)
         {
             this.tabStrip.Dock = DockStyle.Left;
             this.splitter.Dock = DockStyle.Left;
             this.scrollBar.Dock = DockStyle.Fill;
         }
         else
         {
             this.tabStrip.Dock = DockStyle.Right;
             this.splitter.Dock = DockStyle.Right;
             this.scrollBar.Dock = DockStyle.Fill;
         }
     }
     base.Controls.AddRange(new Control[] { this.scrollBar, this.splitter, this.tabStrip });
     this.splitter.Size = new Size(6, 6);
     this.splitter.Paint += new PaintEventHandler(this.OnSplitterPaint);
     this.splitter.DoubleClick += new EventHandler(this.OnSplitterDoubleClick);
     ((ItemList<System.Workflow.ComponentModel.Design.ItemInfo>) this.TabStrip.Tabs).ListChanged += new ItemListChangeEventHandler<System.Workflow.ComponentModel.Design.ItemInfo>(this.OnTabsChanged);
     this.BackColor = SystemColors.Control;
     base.ResumeLayout();
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:56,代碼來源:TabControl.cs

示例5: Initialize

		public void Initialize(ScrollBar v, ScrollBar h) {
			this.VerticalSB = v;
			this.HorizontalSB = h;
			this.Texture = null;

			Buffer = new Selection[BUFFER_SIZE];

			for (int i = 0; i < BUFFER_SIZE; i++) {
				Buffer[i] = new Selection {
					                          GridWidth = 1, GridHeight = 1
				                          };
			}
		}
開發者ID:Hakua,項目名稱:PokeSharp,代碼行數:13,代碼來源:ControlTextureExtractor.cs

示例6: AdjustScrollbar

        private void AdjustScrollbar(float t, ScrollBar scrollMax, ScrollBar scrollMin)
        {
            if (t > scrollMax.Maximum)
            {
                scrollMax.Maximum = (int) t;
                scrollMax.Minimum = scrollMin.Maximum;
            }

            if (t < scrollMin.Minimum)
            {
                scrollMin.Minimum = (int) t;
                scrollMin.Maximum = scrollMax.Minimum;
            }
        }
開發者ID:eried,項目名稱:LaserTurretKinect,代碼行數:14,代碼來源:FormMain.cs

示例7: SideBarControl

        public SideBarControl(SideBar nSideBar)
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.CacheText, true);
            AllowDrop = true;

            mMouseWheelHandler = new MouseWheelHandler();
            mSideTabContent = new SideTabContent(nSideBar);
            mScrollBar = new VScrollBar();
            mScrollBar.Scroll += new ScrollEventHandler(_scrollBarScrolled);
            mSideBar = nSideBar;
            mMouseDownTab = null;
            Controls.Add(mScrollBar);
            Controls.Add(mSideTabContent);
        }
開發者ID:zyouhua,項目名稱:nvwa,代碼行數:16,代碼來源:SideBarControl.cs

示例8: SystemScrollBarAdapter

 public SystemScrollBarAdapter(Orientation orientation)
 {
     switch(orientation)
     {
         case Orientation.Vertical:
             _scrollBar = new VScrollBar();
             break;
         case Orientation.Horizontal:
             _scrollBar = new HScrollBar();
             break;
         default:
             throw new ArgumentException("orientation");
     }
     _scrollBar.Scroll += OnScrollBarScroll;
     _scrollBar.ValueChanged += OnScrollBarValueChanged;
     _orientation = orientation;
 }
開發者ID:Kuzq,項目名稱:gitter,代碼行數:17,代碼來源:SystemScrollBarAdapter.cs

示例9: ScrollBarReplacement

        public ScrollBarReplacement(System.Windows.Forms.ScrollBar sb)
        {
            m_ParentScrollBar = sb;
            m_ParentScrollBarWndProc = (IScrollBarExtender)m_ParentScrollBar;
            m_IsVScrollBar = m_ParentScrollBar is VScrollBar;

            m_ScrollBarCore = new ScrollBarCore(m_ParentScrollBar, false);
            m_ScrollBarCore.ValueChanged += new EventHandler(ScrollBarCore_ValueChanged);
            if (m_ParentScrollBar is HScrollBar)
                m_ScrollBarCore.Orientation = eOrientation.Horizontal;
            else
                m_ScrollBarCore.Orientation = eOrientation.Vertical;
            m_ScrollBarCore.Minimum = m_ParentScrollBar.Minimum;
            m_ScrollBarCore.Maximum = m_ParentScrollBar.Maximum;
            m_ScrollBarCore.Value = m_ParentScrollBar.Value;
            m_ScrollBarCore.Enabled = m_ParentScrollBar.Enabled;
            m_ParentScrollBar.EnabledChanged += new EventHandler(ParentScrollBar_EnabledChanged);
        }
開發者ID:huamanhtuyen,項目名稱:VNACCS,代碼行數:18,代碼來源:ScrollBarReplacement.cs

示例10: ScrollBarImplementation

        public ScrollBarImplementation(System.Windows.Forms.ScrollBar sb)
        {
            m_ParentScrollBar = sb;
            m_ParentScrollBarWndProc = (IScrollBarExtender)m_ParentScrollBar;
            m_IsVScrollBar = m_ParentScrollBar is VScrollBar;

            m_PaintTimer = new Timer();
            m_PaintTimer.Interval = 50;
            m_PaintTimer.Tick += new EventHandler(PaintTimerTick);

            m_ScrollBarCore = new ScrollBarCore(m_ParentScrollBar, true);
            //m_ScrollBarCore.IsAppScrollBarStyle = false;
            if (m_ParentScrollBar is HScrollBar)
                m_ScrollBarCore.Orientation = eOrientation.Horizontal;
            else
                m_ScrollBarCore.Orientation = eOrientation.Vertical;
            m_ScrollBarCore.Minimum = m_ParentScrollBar.Minimum;
            m_ScrollBarCore.Maximum = m_ParentScrollBar.Maximum;
            m_ScrollBarCore.Value = m_ParentScrollBar.Value;
        }
開發者ID:huamanhtuyen,項目名稱:VNACCS,代碼行數:20,代碼來源:ScrollBarImplementation.cs

示例11: ScrollBarControlLogic

        public ScrollBarControlLogic(Panel panel)
        {
            mPanel = panel;

            mVerticalScrollBar = new VScrollBar();
            mVerticalScrollBar.Dock = DockStyle.Right;
            //mVerticalScrollBar.Scroll += HandleVerticalScroll;
            mVerticalScrollBar.ValueChanged += HandleVerticalScroll;
            panel.Controls.Add(mVerticalScrollBar);

            mHorizontalScrollBar = new HScrollBar();
            mHorizontalScrollBar.Dock = DockStyle.Bottom;

            mHorizontalScrollBar.ValueChanged += HandleHorizontalScroll;
            panel.Controls.Add(mHorizontalScrollBar);

            UpdateToImage(2048, 2048);

            mPanel.Resize += HandlePanelResize;

        }
開發者ID:vchelaru,項目名稱:FlatRedBall,代碼行數:21,代碼來源:ScrollBarControlLogic.cs

示例12: DeltaList

        public DeltaList()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
                ControlStyles.Opaque | ControlStyles.ResizeRedraw |
                ControlStyles.Selectable,
                true
            );

            BackColor = SystemColors.Window;
            ForeColor = SystemColors.WindowText;

            ScrollBar = new VScrollBar {
                SmallChange = 1,
                LargeChange = 8,
                TabStop = false
            };

            ScrollBar.Scroll += ScrollBar_Scroll;
            OnResize(EventArgs.Empty);

            Controls.Add(ScrollBar);
        }
開發者ID:kg,項目名稱:HeapProfiler,代碼行數:23,代碼來源:DeltaList.cs

示例13: DrawScrollBar

		public override void DrawScrollBar (Graphics dc, Rectangle clip, ScrollBar bar)
		{
			int		scrollbutton_width = bar.scrollbutton_width;
			int		scrollbutton_height = bar.scrollbutton_height;
			Rectangle	first_arrow_area;
			Rectangle	second_arrow_area;			
			Rectangle	thumb_pos;
			
			thumb_pos = bar.ThumbPos;

			if (bar.vert) {
				first_arrow_area = new Rectangle(0, 0, bar.Width, scrollbutton_height);
				bar.FirstArrowArea = first_arrow_area;

				second_arrow_area = new Rectangle(0, bar.ClientRectangle.Height - scrollbutton_height, bar.Width, scrollbutton_height);
				bar.SecondArrowArea = second_arrow_area;

				thumb_pos.Width = bar.Width;
				bar.ThumbPos = thumb_pos;

				Brush VerticalBrush;
				/* Background, upper track */
				if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards)
					VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black);
				else
					VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White);
				Rectangle UpperTrack = new Rectangle (0, 0, bar.ClientRectangle.Width, bar.ThumbPos.Bottom);
				if (clip.IntersectsWith (UpperTrack))
					dc.FillRectangle (VerticalBrush, UpperTrack);

				/* Background, lower track */
				if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward)
					VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black);
				else
					VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White);
				Rectangle LowerTrack = new Rectangle (0, bar.ThumbPos.Bottom, bar.ClientRectangle.Width, bar.ClientRectangle.Height - bar.ThumbPos.Bottom);
				if (clip.IntersectsWith (LowerTrack))
					dc.FillRectangle (VerticalBrush, LowerTrack);

				/* Buttons */
				if (clip.IntersectsWith (first_arrow_area))
					CPDrawScrollButton (dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state);
				if (clip.IntersectsWith (second_arrow_area))
					CPDrawScrollButton (dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state);
			} else {
				first_arrow_area = new Rectangle(0, 0, scrollbutton_width, bar.Height);
				bar.FirstArrowArea = first_arrow_area;

				second_arrow_area = new Rectangle (bar.ClientRectangle.Width - scrollbutton_width, 0, scrollbutton_width, bar.Height);
				bar.SecondArrowArea = second_arrow_area;

				thumb_pos.Height = bar.Height;
				bar.ThumbPos = thumb_pos;

				Brush HorizontalBrush;
				//Background, left track
				if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards)
					HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black);
				else
					HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White);
				Rectangle LeftTrack = new Rectangle (0, 0, bar.ThumbPos.Right, bar.ClientRectangle.Height);
				if (clip.IntersectsWith (LeftTrack))
					dc.FillRectangle (HorizontalBrush, LeftTrack);

				//Background, right track
				if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward)
					HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black);
				else
					HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White);
				Rectangle RightTrack = new Rectangle (bar.ThumbPos.Right, 0, bar.ClientRectangle.Width - bar.ThumbPos.Right, bar.ClientRectangle.Height);
				if (clip.IntersectsWith (RightTrack))
					dc.FillRectangle (HorizontalBrush, RightTrack);

				/* Buttons */
				if (clip.IntersectsWith (first_arrow_area))
					CPDrawScrollButton (dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state);
				if (clip.IntersectsWith (second_arrow_area))
					CPDrawScrollButton (dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state);
			}

			/* Thumb */
			ScrollBar_DrawThumb(bar, thumb_pos, clip, dc);				
		}
開發者ID:ngraziano,項目名稱:mono,代碼行數:83,代碼來源:ThemeWin32Classic.cs

示例14: OnScroll

 bool IWorkflowDesignerMessageSink.OnScroll(ScrollBar sender, int value)
 {
     try
     {
         OnScroll(sender, value);
     }
     catch
     {
     }
     return true;
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:11,代碼來源:ActivityDesigner.cs

示例15: SetScroll

	    private void SetScroll( ScrollBar scrollBar, Axis axis, double scrollMin, double scrollMax )
		{
			if ( scrollBar != null && axis != null )
			{
				scrollBar.Minimum = 0;
				scrollBar.Maximum = _ScrollControlSpan - 1;

				if ( scrollMin > axis._scale._min )
					scrollMin = axis._scale._min;
				if ( scrollMax < axis._scale._max )
					scrollMax = axis._scale._max;

				int val = 0;

				Scale scale = axis._scale;
				double minLinearized = scale._minLinearized;
				double maxLinearized = scale._maxLinearized;
				scrollMin = scale.Linearize( scrollMin );
				scrollMax = scale.Linearize( scrollMax );

				double scrollMin2 = scrollMax - ( maxLinearized - minLinearized );
				/*
				if ( axis.Scale.IsLog )
					scrollMin2 = scrollMax / ( axis._scale._max / axis._scale._min );
				else
					scrollMin2 = scrollMax - ( axis._scale._max - axis._scale._min );
				*/
				if ( scrollMin >= scrollMin2 )
				{
					//scrollBar.Visible = false;
					scrollBar.Enabled = false;
					scrollBar.Value = 0;
				}
				else
				{
					double ratio = ( maxLinearized - minLinearized ) / ( scrollMax - scrollMin );

					/*
					if ( axis.Scale.IsLog )
						ratio = ( Math.Log( axis._scale._max ) - Math.Log( axis._scale._min ) ) /
									( Math.Log( scrollMax ) - Math.Log( scrollMin ) );
					else
						ratio = ( axis._scale._max - axis._scale._min ) / ( scrollMax - scrollMin );
					*/

					int largeChange = (int)( ratio * _ScrollControlSpan + 0.5 );
					if ( largeChange < 1 )
						largeChange = 1;
					scrollBar.LargeChange = largeChange;

					int smallChange = largeChange / _ScrollSmallRatio;
					if ( smallChange < 1 )
						smallChange = 1;
					scrollBar.SmallChange = smallChange;

					int span = _ScrollControlSpan - largeChange;

					val = (int)( ( minLinearized - scrollMin ) / ( scrollMin2 - scrollMin ) *
									span + 0.5 );
					/*
					if ( axis.Scale.IsLog )
						val = (int)( ( Math.Log( axis._scale._min ) - Math.Log( scrollMin ) ) /
								( Math.Log( scrollMin2 ) - Math.Log( scrollMin ) ) * span + 0.5 );
					else
						val = (int)( ( axis._scale._min - scrollMin ) / ( scrollMin2 - scrollMin ) *
								span + 0.5 );
					*/
					if ( val < 0 )
						val = 0;
					else if ( val > span )
						val = span;

					//if ( ( axis is XAxis && axis.IsReverse ) || ( ( ! axis is XAxis ) && ! axis.IsReverse ) )
					if ( ( axis is XAxis ) == axis.Scale.IsReverse )
						val = span - val;

					if ( val < scrollBar.Minimum )
						val = scrollBar.Minimum;
					if ( val > scrollBar.Maximum )
						val = scrollBar.Maximum;

					scrollBar.Value = val;
					scrollBar.Enabled = true;
					//scrollBar.Visible = true;
				}
			}
		}
開發者ID:CareyGit,項目名稱:jx,代碼行數:87,代碼來源:GraphControl.ScrollBars.cs


注:本文中的System.Windows.Forms.ScrollBar類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。