views:

46

answers:

1

I have a UserControl and I want to make custom scrolling. Can I use the already built in Horizontal and Vertical ScrollBars without setting the AutoScroll flag to true? I can Enable and define min and max value for both ScrollBars and I can see them on my control, but when clicking the buttons they don't move and in the scroll events I don't get any useful value.

            HorizontalScroll.Value = 0;
            VerticalScroll.Value = 0;
            HorizontalScroll.Minimum = 0;
            HorizontalScroll.Maximum = 900;
            VerticalScroll.Minimum = 0;
            VerticalScroll.Maximum = 600;
            HorizontalScroll.Visible = true;
            VerticalScroll.Visible = true;
            HorizontalScroll.SmallChange = 2;
            HorizontalScroll.LargeChange = 4;
            HorizontalScroll.Enabled = true;
            VerticalScroll.Enabled = true;
            this.Scroll += new ScrollEventHandler(PanelsHolder_Scroll);

in the Scroll Event I can't get any changes. Any way to use the built-in without I have to add the scrolls controls manually?

A: 

Don't see why not to use AutoScroll.

if you use the controllers, you'll have to move the controls by your self.

use e.NewValue to determined the value of the scroll. (in the event)

Itay
my control is mapping a huge image( I'm using the PaintBackGround to show it), and over the image I insert some controls( which I already need to manually change their location). Now the Control has a given Size.. the Size of the Image behind may change and most of the time will be larger that the Control. Is there a way I can tell the Control that it's real size is not the one it has in the UI so that the AutoScroll knows what size give to the Thumbs?
jmayor
i'm not sure i understand, but you can put it alone in another separate userconrol, and then AutoScroll it..
Itay