本文整理汇总了C#中System.Windows.Forms.ScrollBar类的典型用法代码示例。如果您正苦于以下问题:C# ScrollBar类的具体用法?C# ScrollBar怎么用?C# ScrollBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScrollBar类属于System.Windows.Forms命名空间,在下文中一共展示了ScrollBar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ProcessEventStuff
private void ProcessEventStuff( ScrollBar scrollBar, ScrollEventArgs e )
{
if ( e.Type == ScrollEventType.ThumbTrack )
{
if ( ScrollProgressEvent != null )
ScrollProgressEvent( this, hScrollBar1, _zoomState,
new ZoomState( GraphPane, ZoomState.StateType.Scroll ) );
}
else // if ( e.Type == ScrollEventType.ThumbPosition )
{
if ( _zoomState != null && _zoomState.IsChanged( GraphPane ) )
{
//this.GraphPane.ZoomStack.Push( _zoomState );
ZoomStatePush( GraphPane );
// Provide Callback to notify the user of pan events
if ( ScrollDoneEvent != null )
ScrollDoneEvent( this, hScrollBar1, _zoomState,
new ZoomState( GraphPane, ZoomState.StateType.Scroll ) );
_zoomState = null;
}
}
if ( ScrollEvent != null )
ScrollEvent( scrollBar, e );
}
开发者ID:CareyGit,项目名称:jx,代码行数:27,代码来源:GraphControl.ScrollBars.cs
示例17: zgc_ScrollProgressEvent
void zgc_ScrollProgressEvent( ZedGraphControl sender, ScrollBar scrollBar, ZoomState oldState,
ZoomState newState )
{
//this.toolStripStatusLabel1.Text = sender.GraphPane.XAxis.Scale.Max.ToString();
// When scroll action is finished, recalculate the axis ranges
sender.AxisChange();
sender.Refresh();
}
开发者ID:Jungwon,项目名称:ZedGraph,代码行数:8,代码来源:Form1.cs
示例18: Initialize
public void Initialize(ScrollBar scrollbar) {
this.scrollbar = scrollbar;
this.scrolling = new FluentScrolling(scrollbar);
}
开发者ID:Hakua,项目名称:PokeSharp,代码行数:4,代码来源:ControlLogicSelector.cs
示例19: RemoveScrollBar
private void RemoveScrollBar()
{
// Do we need to remove the scrollbar?
if ((_scrollBar != null) && !_removing)
{
// Prevent recreate of the control during removal, as removing it
// will cause more layout cycles to occur. We put it back to false
// at the end of the remove process.
_removing = true;
// Unhook from events
_scrollBar.Scroll -= new ScrollEventHandler(OnScrollBarChange);
// Hide the scrollbar from view
_scrollBar.Hide();
// Remove scrollbar from containing collection
CommonHelper.RemoveControlFromParent(_scrollBar);
// Destroy the current scrollbar
_scrollBar.Dispose();
_scrollBar = null;
_removing = false;
}
}
开发者ID:yp25,项目名称:Krypton,代码行数:26,代码来源:ViewDrawScrollBar.cs
示例20: Scroll
/// <summary>
/// Scrolls the view according to the given ScrollEventArgs.
/// </summary>
/// <param name="scrollBar">The source of the ScrollEvent.</param>
/// <param name="e">A ScrollEventArgs containing the event data.</param>
/// <param name="animateFirst">
/// A boolean value indicating whether or not to animate the first scroll.
/// </param>
protected virtual void Scroll(ScrollBar scrollBar, ScrollEventArgs e, bool animateFirst) {
// If we are animating, terminate any previous scroll activities.
if (animateScrolls) {
TerminatePreviousScroll(scrollBar, e);
}
if (e.Type != ScrollEventType.EndScroll) {
Point viewPosition;
if (scrollBar is VScrollBar) {
viewPosition = new Point(ViewPosition.X, e.NewValue);
} else {
viewPosition = new Point(e.NewValue, ViewPosition.Y);
}
// At the Start of a scroll sequence, we will animate the scroll if
// animateScrolls is set to true.
if (startOfScrollSequence && animateFirst) {
if (e.Type != ScrollEventType.ThumbTrack) {
SetViewPosition(viewPosition, true);
e.NewValue = scrollBar.Value;
}
startOfScrollSequence = false;
}
else {
if (!Canvas.Interacting) Canvas.Interacting = true;
// Otherwise, just set the position directly.
SetViewPosition(viewPosition, false);
}
} else {
// Reset some flags at the End of a scroll sequence.
startOfScrollSequence = true;
if (Canvas.Interacting) Canvas.Interacting = false;
}
}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:43,代码来源:PScrollableControl.cs
注:本文中的System.Windows.Forms.ScrollBar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论