Search
Scrolling and Zooming

Scrollbars

If FlowChartX is instantiated in its own window (i.e. it is not windowless), built-in scrollbars are created, but they are initially invisible. Use the ShowScrollers and HideScrollers methods to change their visibility state. If the scrollbars are not needed because the visible region is larger than the document size, they are either hidden or disabled, as set via DisableNoScroll.

If the control is instantiated windowless, it does not have its own scrollbars. In such case you can create external scrollbars and register them with FlowChartX using RegExtrScrollers method. Additionally, you have to forward the WM_RESIZE, WM_HSCROLL and WM_VSCROLL messages to FlowChartX, using the OnWindowMessage member of the IOleInPlaceObjectWindowless interface. If that's done correctly, external scrollbars perform just as the built-in ones would do if the control is created in its own window.

No matter what type of scrollbars are used, position and size of their thumbs as well their page size, are automatically updated to reflect the document size, zoom factor and scroll position. The ScrollRate property allows specifying the increment to be applied to scroll position when a scrollbar button is clicked.

Automatic scrolling

The AutoScroll property enables or disables automatic scrolling. If automatic scrolling is enabled and a user drags an item outside FlowChartX' visual area, or moves the mouse pointer near the borders as specified in ScrollZoneSize, FlowChartX scrolls its view towards the mouse cursor location. Automatic scrolling can be done either by fixed steps or by ones large enough to keep the currently dragged item visible; to specify that, set AutoScrollType.

Document area

Document size is set via the SetDocSize method. That size defines the extents of the diagram area that can be brought into view via scrolling. The DocPtToClientPt method converts document coordinates to client-area coordinates. For windowless controls, the client area is that of the container window. Windowed controls' client area equals the controls window area.

The size can be configured to grow automatically when users move nodes around. To enable that, set the AutoSizeDoc and AutoSizeDirections properties.

Setting scroll position

To scroll the diagram contents programmatically, use the ScrollTo method or ScrollX and ScrollY properties. The BringIntoView method changes scroll position in order to make a specific diagram item visible in the current view.

Scrolling table rows

Tables can be scrolled too. If the Scrollable property of a table is set to true, a scroller button is displayed in the table's caption area. By means of this button a user can scroll table's rows. Scrolling can also be done programmatically using the CurrScrollRow property.

Zooming

Zooming is controlled through the ZoomFactor property, ZoomIn and ZoomOut methods. The zoom factor is expressed in percents, 100% meaning no zoom. Higher than 100% makes the document objects look closer and bigger on the screen - zooming in. Less than 100% makes objects look further and smaller on screen - zooming out. The ZoomIn method increases zoom factor by 10%. Respectively the ZoomOut method decreases zoom factor again by 10%.