How to set the position of the scroll bars by code

May 4, 2012 at 4:45 PM

I am just experimenting with the new 2.0 version and I like the framework pretty much. I consider it a valuable extension to our network documentation tool and I think I will ask for a license in the near future.

But I have one issue that is a little bit annoying:

When I place the display on a tab page of a (DevExpress) Tab Control or on a (DevExpress) dock panel then the display automatically centers itself when I switch tabs resp. panels. Both scroll bars are set to their center position. I wonder whether this is a bug or by design?

To work around this, I would like to read and set the origin of the displayed diagram or the positions of the scroll bars but I have found no corresponding properties or functions.

Cheers, Ralf

Coordinator
May 7, 2012 at 9:20 AM
RalfLuethke wrote:
But I have one issue that is a little bit annoying:
When I place the display on a tab page of a (DevExpress) Tab Control or on a (DevExpress) dock panel then the display automatically centers itself when I switch tabs resp. panels. Both scroll bars are set to their center position.

You are right. It's probably more desirable that the display keeps its last position when switching to other displays.
We will change this with the next release.

RalfLuethke wrote:
To work around this, I would like to read and set the origin of the displayed diagram or the positions of the scroll bars but I have found no corresponding properties or functions.

You can get the displayed area from the Display.DrawBounds property in control coordinates.
Convert this rectangle into display coordinates with Display.ControlToDiagram(...) and call Display.EnsureVisible in order to restore the previous position. Remember to update the ZoomLevel before (otherwise the coordinates might not match).

Best regards,
Kurt