SECZoomView Class

class SECZoomView: public CScrollView

SECZoomView is a CScrollView extension that adds automatic zooming to your application views.

Defined in: SECZMVW.H

Comments

SECZoomView does this by overloading the CScrollView::OnPrepareDC method and performing zooming through standard Windows GDI mapping modes. MM_ANISOTROPIC is the only supported mapping mode. If you must use a mapping mode other than MM_ANISOTROPIC, SECZoomView cannot be used. If your current CScrollView changes the mapping modes with an OnPrepareDC override, you will need to turn off these changes as they will nullify the effects of SECZoomView.

SEC_ZOOMOFF

Zooming is disabled.

SEC_ZOOMNORMAL

Zooming is performed based on a floating point zoom factor. This can be specified as a zoom percentage as well.

SEC_ZOOMFIT

The SECZoomView automatically changes the zoom level such that all portions of the view are visible inside the view window.

The developer can specify a min/max zoom which is appropriate for the application and platform. The default is infinite zooming, but this will cause ‘wrap’ as the values which track scrolling overflow. The ‘wrap’ factor depends on the operating system (Win16 has lower tolerences than Win32, etc.) A SECZoomView can be zoomed by specifying a zoom percentage, a rectangle to be zoomed, or a zoom factor.

SECZoomView provides an overridable callback, ZoomLevelChanged, that is called whenever the zoom level changes so that any user interface elements can be updated. The simplicity of this approach allows any number of interesting zoom user interfaces to be used.

The CLOUD sample in the \SAMPLES\TOOLKIT\STANDARD\VIEWS\CLOUD directory shows the SECZoomView and SECPanView classes in action.

See Also

SECPanView

Class Members

Protected Members Constructors

SECZoomView()

Creates an SECZoomView object.

Overridable

virtual void ZoomLevelChanged(void)

Override ZoomLevelChanged to receive notifications that the zoom level has been modified. Good for

virtual void ZoomOutOfRange(BOOL bUnderFlow, float fAttempt)

Called when an attempt is made to zoom beyond allowed range.

virtual void SetZoomLevel(float)

Sets the current zoom level.

Public Members Zooming Operations

UINT GetZoomMode()

Gets the current zoom mode setting.

float GetZoomLevel()

Retrieves the floating point zoom factor.

void SetZoomMinMax(float fMin, float fMax)

Restrict the zoom factor to a minimum and maximum zooming factor.

void SetZoomMinMaxPercent(int nMin, int nMax)

Restrict the zoom factor to a minimum and maximum zoom percent.

void SetZoomMode(UINT zoomMode)

Sets the zoom mode to either SEC_ZOOMOFF, SEC_ZOOMNORMAL, or SEC_ZOOMFIT.

virtual void ZoomIn(CRect &rect)

Increases the zoom level.

virtual void ZoomIn(CPoint *point = NULL, float delta = 1.25)

Increases the zoom level.

virtual void ZoomOut(CPoint *point = NULL, float delta = 1.25)

Decreases the zoom level.

virtual void ZoomOriginal(CPoint *point = NULL)

Sets the zoom level to 100%, or no zooming.

virtual void ZoomFit()

todo Add a description

virtual void ZoomPercent(int nPercent = 25,CPoint *point = NULL)

Zooms in or out based on a percent. For example, 200% will zoom in, where 5% will zoom out.