Scrollbar example for a control

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
 
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?


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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top