Scrollbar example for a control

  • Thread starter Thread starter Sonnich Jensen
  • Start date Start date
S

Sonnich Jensen

Hi

I have a control, which has a header and some data - pretty much a string/data grid

Now, I can scroll the entire component, but that is not what I want to do

Does anyone know of any examples like this?

WBR
Sonnich
 
Hi

I have a control, which has a header and some data - pretty much a string/data grid

Now, I can scroll the entire component, but that is not what I want to do

Does anyone know of any examples like this?


I found a solution:

public partial class MyControl : UserControl
{
ScrollBar vScrollBar1;

public MyControl()
{
InitializeComponent();

DoubleBuffered = true;

vScrollBar1 = new VScrollBar();
vScrollBar1.Dock = DockStyle.Right;
vScrollBar1.ValueChanged += vScrollBar1_ValueChanged;
this.Controls.Add(vScrollBar1);
// but using top and other properties one can place it anywhere on the control :)
}

/// when scrolled then force redraw // using right side scroll bar
public void vScrollBar1_ValueChanged(Object sender, EventArgs e)
{
Invalidate();
}

In the paint event use vScrollBar1.Value - but not is goes from 0 to 91 (not 100)
 
Back
Top