Partager via


CDC::SetViewportOrg

Sets the viewport origin of the device context.

virtual CPoint SetViewportOrg( 
   int x, 
   int y  
); 
CPoint SetViewportOrg( 
   POINT point  
);

Parameters

  • x
    Specifies the x-coordinate (in device units) of the origin of the viewport. The value must be within the range of the device coordinate system.

  • y
    Specifies the y-coordinate (in device units) of the origin of the viewport. The value must be within the range of the device coordinate system.

  • point
    Specifies the origin of the viewport. The values must be within the range of the device coordinate system. You can pass either a POINT structure or a CPoint object for this parameter.

Return Value

The previous origin of the viewport (in device coordinates) as a CPoint object.

Remarks

The viewport, along with the device-context window, defines how GDI maps points in the logical coordinate system to points in the coordinate system of the actual device. In other words, they define how GDI converts logical coordinates into device coordinates.

The viewport origin marks the point in the device coordinate system to which GDI maps the window origin, a point in the logical coordinate system specified by the SetWindowOrg member function. GDI maps all other points by following the same process required to map the window origin to the viewport origin. For example, all points in a circle around the point at the window origin will be in a circle around the point at the viewport origin. Similarly, all points in a line that passes through the window origin will be in a line that passes through the viewport origin.

Example

See the example for CView::OnPrepareDC.

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

CDC::SetWindowOrg

CPoint Class

POINT Structure

CDC::GetViewportOrg