Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2003, 12:14 AM
Authorized User
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Panel AutoScroll

I'm having trouble restoring a panel's auto scroll position after resizing
some of its contained controls.

To store the current scroll position, I make a copy of the panel's auto scroll
position as follows:
   oAutoScrollPosition = New System.Drawing.Point(m_panPanel.AutoScrollPosition .X,
m_panPanel.AutoScrollPosition.Y)

Then to restore after resizing the contained controls, I do this:
   m_panPanel.AutoScrollPosition = oAutoScrollPosition

Problem is that this code has no effect. The scroll position is not restored.

Any ideas?


 
Old July 16th, 2003, 04:13 AM
Authorized User
 
Join Date: May 2003
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you must store the position of the control in a separate object before scrolling start and when the user release the mouse button then set the position with the new value.

Quote:
quote:Originally posted by Dave Doknjas
 I'm having trouble restoring a panel's auto scroll position after resizing
some of its contained controls.

To store the current scroll position, I make a copy of the panel's auto scroll
position as follows:
oAutoScrollPosition = New System.Drawing.Point(m_panPanel.AutoScrollPosition .X,
m_panPanel.AutoScrollPosition.Y)

Then to restore after resizing the contained controls, I do this:
m_panPanel.AutoScrollPosition = oAutoScrollPosition

Problem is that this code has no effect. The scroll position is not restored.

Any ideas?


Deepesh Jain
VB,VBA & .NET Specialist
Wiley Support Team
 
Old August 27th, 2003, 03:41 PM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You probably already have the answer but just in case... when you get the autoscrollposition it gives you something like x=0, y=-132. Well it is the - that is giving you the problem. What you want to do is:
Point storedPosition = new Point(panel.AutoScrollPosition.X, Math.Abs(panel.AutoScrollPosition.Y))

Then when you reset your autoscrollposition it will work.

The big question is how do you keep it from repositioning in the first place? Thats the one I need to know.

Rob.





Similar Threads
Thread Thread Starter Forum Replies Last Post
loop a panel abhishek0807 ASP.NET 1.0 and 1.1 Basics 1 March 13th, 2007 07:00 AM
Panel.visible shai505 C# 1 April 25th, 2006 05:10 AM
ViewState problem when adding a panel to a panel koekie17 C# 3 February 20th, 2006 09:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.