alenwong
asked on
Scroll the scrollbar of the panel automaically
Hi experts,
I'd like to know how to scroll programically the scrollbar of a panel. The panel contains a very long panorama in which I would like the panel to programmically scroll to particular location when user clicks a button. Thanks in advance.
I'd like to know how to scroll programically the scrollbar of a panel. The panel contains a very long panorama in which I would like the panel to programmically scroll to particular location when user clicks a button. Thanks in advance.
WinForms or WebForms?
Is there by chance a control in the Panel that you want to scroll to?
Is there by chance a control in the Panel that you want to scroll to?
ASKER
My Programming Language is c#, and I am using Visual Studio 2005 and .NET Framework 2.0, thanks
Still not enough info.
Windows application?
or Web application?
Do you just want the scrollbar to move down?
Or do you want to move it so that a particular control is in view?
Or do you want to move it to xxx percentage of the way down?
You might want ScrollableControl.ScrollCo ntrolIntoV iew():
http://msdn2.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol.scrollcontrolintoview(VS.80).aspx
panel1.ScrollControlIntoVi ew(label1) ;
Or you can use the SendMessage() API with WM_VSCROLL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/scrollbars/scrollbarreference/scrollbarmessages/wm_vscroll.asp
An example:
http://weblogs.asp.net/israelio/archive/2004/07/20/188664.aspx
Windows application?
or Web application?
Do you just want the scrollbar to move down?
Or do you want to move it so that a particular control is in view?
Or do you want to move it to xxx percentage of the way down?
You might want ScrollableControl.ScrollCo
http://msdn2.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol.scrollcontrolintoview(VS.80).aspx
panel1.ScrollControlIntoVi
Or you can use the SendMessage() API with WM_VSCROLL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/scrollbars/scrollbarreference/scrollbarmessages/wm_vscroll.asp
An example:
http://weblogs.asp.net/israelio/archive/2004/07/20/188664.aspx
ASKER
It is a Windows Application
I am displaying a image in a picturebox control which is in a panel control. The height of the picturebox was fixed within the panel (so vertical scolling is not needed anyhow), the width of the picturebox will scale according to the ratio of the height of the image to the height of the picturebox, and the image will fit in the size-adjusted picturebox so that horizontal scrolling may required if the width of picturebox is larger than the width of panel.
I would like to know how to scroll the panel xxx percentage of the way to the right by coding. The value would be generated by other part of the program each time so there is no fixed value.
Thanks in advance
based on scale between the height of the picturebox and the image,
I am displaying a image in a picturebox control which is in a panel control. The height of the picturebox was fixed within the panel (so vertical scolling is not needed anyhow), the width of the picturebox will scale according to the ratio of the height of the image to the height of the picturebox, and the image will fit in the size-adjusted picturebox so that horizontal scrolling may required if the width of picturebox is larger than the width of panel.
I would like to know how to scroll the panel xxx percentage of the way to the right by coding. The value would be generated by other part of the program each time so there is no fixed value.
Thanks in advance
based on scale between the height of the picturebox and the image,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can set the panel's scrollTop property:
[Javascript]
document.getElementById('<