By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,979 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,979 IT Pros & Developers. It's quick & easy.

Panel & external VScrollBar

P: n/a
Hello !

I'm trying to combine an external (not part of the panel)
vertical scrollbar (VScrollBar) with a panel in order to
scroll the content of the panel vertically using the external
VScrollbar. I can't set the "AutoScroll"-property to true and
then use the generated scrollbars inside the panel,
because i have to use this external scrollbar which is a
modified/customized scrollbar, and doesn't look like a
standard scrollbar.

I've experiemented a litte bit, but until now i'm quite unsure.
What is a good way to to achieve this?
Source samples are highly appreciated.

Thanks in advance and have a nice weekend !
Sascha

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sascha,

I would have a property on the Panel (or take these values in the
constructor, assuming that you are deriving your class from Panel) which
takes the scrollbars that are to be used to manipulate the view. Then, you
can attach to the events indicating that the value of the scrollbar changes,
and adjust your view appropriately.

Either that, or expose a method where you can set what the panel is
viewing and have the event handler for the container control link the two
together when the scrollbars change.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sascha Schmidt" <Sa****@nospam.de> wrote in message
news:da**********@mail.lachmann-rink.de...
Hello !

I'm trying to combine an external (not part of the panel)
vertical scrollbar (VScrollBar) with a panel in order to
scroll the content of the panel vertically using the external
VScrollbar. I can't set the "AutoScroll"-property to true and
then use the generated scrollbars inside the panel,
because i have to use this external scrollbar which is a
modified/customized scrollbar, and doesn't look like a
standard scrollbar.

I've experiemented a litte bit, but until now i'm quite unsure.
What is a good way to to achieve this?
Source samples are highly appreciated.

Thanks in advance and have a nice weekend !
Sascha

Nov 17 '05 #2

P: n/a
Hello again!

To describe my problem more precisely:
It's more a technical than an architectical problem.

Until now i discovered two ways to manipulate the "scroll-position"
of the frame:
Using window messages to move one line up and down, for example

SendMessage(pnlScroll.ThePanel.Handle, WM_VSCROLL, SB_TOP, new
IntPtr(0));

or modify the coordinates of the property "AutoScrollPosition"
in the "Scroll"-Event of the external scrollbar like :

private void sgvScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
int modifFactor = 3;
pnlScroll.ThePanel.AutoScrollPosition = new Point(0, e.NewValue *
modifFactor);
}

Both solutions provide scrolling, but until the "AutoScroll" - property
is set to true (i can't do this, you remember ?) both can't scroll
completly down to the bottom (they stop about 2/3 of the way).

I changed the "modifFactor", but that doesn't change.

So my remaining questions are:
1) How do i get a scroll solution that is fully functional
(among other things: Scroll fully to bottom) ?
2) How do i calculate the "min" and "max" property for
the external Scrollbar, so that it fits to the size of
the panel ?
3) Is the event "Scroll"-event of the scrollbar the right
one for this purpose? Do i need other properties / events
of the scrollbar?

Again, thanks in advance
Sascha
Nicholas Paldino [.NET/C# MVP] schrieb:
Sascha,

I would ...

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.