Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SetViewportOrgEx function

The SetViewportOrgEx function specifies which device point maps to the window origin (0,0).

Syntax


BOOL SetViewportOrgEx(
  _In_   HDC     hdc,
  _In_   int     X,
  _In_   int     Y,
  _Out_  LPPOINT lpPoint
);

Parameters

hdc [in]

A handle to the device context.

X [in]

The x-coordinate, in device units, of the new viewport origin.

Y [in]

The y-coordinate, in device units, of the new viewport origin.

lpPoint [out]

A pointer to a POINT structure that receives the previous viewport origin, in device coordinates. If lpPoint is NULL, this parameter is not used.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

This function (along with SetViewportExtEx and SetWindowExtEx) helps define the mapping from the logical coordinate space (also known as a window) to the device coordinate space (the viewport). SetViewportOrgEx specifies which device point maps to the logical point (0,0). It has the effect of shifting the axes so that the logical point (0,0) no longer refers to the upper-left corner.



//map the logical point (0,0) to the device point (xViewOrg, yViewOrg) 
SetViewportOrgEx ( hdc, xViewOrg, yViewOrg, NULL)


This is related to the SetWindowOrgEx function. Generally, you will use one function or the other, but not both. Regardless of your use of SetWindowOrgEx and SetViewportOrgEx, the device point (0,0) is always the upper-left corner.

Examples

For an example, see Redrawing in the Update Region.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Coordinate Spaces and Transformations Overview
Coordinate Space and Transformation Functions
GetViewportOrgEx
POINT
SetWindowOrgEx

 

 

Community Additions

Show:
© 2015 Microsoft