📄 atlgdi.h
字号:
}
COLORREF SetBkColor(COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::SetBkColor(m_hDC, crColor);
}
int SetBkMode(int nBkMode)
{
ATLASSERT(m_hDC != NULL);
return ::SetBkMode(m_hDC, nBkMode);
}
#ifndef _WIN32_WCE
int SetPolyFillMode(int nPolyFillMode)
{
ATLASSERT(m_hDC != NULL);
return ::SetPolyFillMode(m_hDC, nPolyFillMode);
}
#endif // !_WIN32_WCE
int SetROP2(int nDrawMode)
{
ATLASSERT(m_hDC != NULL);
return ::SetROP2(m_hDC, nDrawMode);
}
#ifndef _WIN32_WCE
int SetStretchBltMode(int nStretchMode)
{
ATLASSERT(m_hDC != NULL);
return ::SetStretchBltMode(m_hDC, nStretchMode);
}
#endif // !_WIN32_WCE
COLORREF SetTextColor(COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::SetTextColor(m_hDC, crColor);
}
#ifndef _WIN32_WCE
BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const
{
ATLASSERT(m_hDC != NULL);
return ::GetColorAdjustment(m_hDC, lpColorAdjust);
}
BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust)
{
ATLASSERT(m_hDC != NULL);
return ::SetColorAdjustment(m_hDC, lpColorAdjust);
}
// Mapping Functions
int GetMapMode() const
{
ATLASSERT(m_hDC != NULL);
return ::GetMapMode(m_hDC);
}
BOOL GetViewportOrg(LPPOINT lpPoint) const
{
ATLASSERT(m_hDC != NULL);
return ::GetViewportOrgEx(m_hDC, lpPoint);
}
int SetMapMode(int nMapMode)
{
ATLASSERT(m_hDC != NULL);
return ::SetMapMode(m_hDC, nMapMode);
}
#endif // !_WIN32_WCE
// Viewport Origin
BOOL SetViewportOrg(int x, int y, LPPOINT lpPoint = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::SetViewportOrgEx(m_hDC, x, y, lpPoint);
}
BOOL SetViewportOrg(POINT point, LPPOINT lpPointRet = NULL)
{
ATLASSERT(m_hDC != NULL);
return SetViewportOrg(point.x, point.y, lpPointRet);
}
#ifndef _WIN32_WCE
BOOL OffsetViewportOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::OffsetViewportOrgEx(m_hDC, nWidth, nHeight, lpPoint);
}
// Viewport Extent
BOOL GetViewportExt(LPSIZE lpSize) const
{
ATLASSERT(m_hDC != NULL);
return ::GetViewportExtEx(m_hDC, lpSize);
}
BOOL SetViewportExt(int x, int y, LPSIZE lpSize = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::SetViewportExtEx(m_hDC, x, y, lpSize);
}
BOOL SetViewportExt(SIZE size, LPSIZE lpSizeRet = NULL)
{
ATLASSERT(m_hDC != NULL);
return SetViewportExt(size.cx, size.cy, lpSizeRet);
}
BOOL ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::ScaleViewportExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize);
}
#endif // !_WIN32_WCE
// Window Origin
#ifndef _WIN32_WCE
BOOL GetWindowOrg(LPPOINT lpPoint) const
{
ATLASSERT(m_hDC != NULL);
return ::GetWindowOrgEx(m_hDC, lpPoint);
}
BOOL SetWindowOrg(int x, int y, LPPOINT lpPoint = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::SetWindowOrgEx(m_hDC, x, y, lpPoint);
}
BOOL SetWindowOrg(POINT point, LPPOINT lpPointRet = NULL)
{
ATLASSERT(m_hDC != NULL);
return SetWindowOrg(point.x, point.y, lpPointRet);
}
BOOL OffsetWindowOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::OffsetWindowOrgEx(m_hDC, nWidth, nHeight, lpPoint);
}
// Window extent
BOOL GetWindowExt(LPSIZE lpSize) const
{
ATLASSERT(m_hDC != NULL);
return ::GetWindowExtEx(m_hDC, lpSize);
}
BOOL SetWindowExt(int x, int y, LPSIZE lpSize = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::SetWindowExtEx(m_hDC, x, y, lpSize);
}
BOOL SetWindowExt(SIZE size, LPSIZE lpSizeRet = NULL)
{
ATLASSERT(m_hDC != NULL);
return SetWindowExt(size.cx, size.cy, lpSizeRet);
}
BOOL ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::ScaleWindowExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize);
}
// Coordinate Functions
BOOL DPtoLP(LPPOINT lpPoints, int nCount = 1) const
{
ATLASSERT(m_hDC != NULL);
return ::DPtoLP(m_hDC, lpPoints, nCount);
}
BOOL DPtoLP(LPRECT lpRect) const
{
ATLASSERT(m_hDC != NULL);
return ::DPtoLP(m_hDC, (LPPOINT)lpRect, 2);
}
BOOL DPtoLP(LPSIZE lpSize) const
{
SIZE sizeWinExt = { 0, 0 };
if(!GetWindowExt(&sizeWinExt))
return FALSE;
SIZE sizeVpExt = { 0, 0 };
if(!GetViewportExt(&sizeVpExt))
return FALSE;
lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeWinExt.cx), abs(sizeVpExt.cx));
lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeWinExt.cy), abs(sizeVpExt.cy));
return TRUE;
}
BOOL LPtoDP(LPPOINT lpPoints, int nCount = 1) const
{
ATLASSERT(m_hDC != NULL);
return ::LPtoDP(m_hDC, lpPoints, nCount);
}
BOOL LPtoDP(LPRECT lpRect) const
{
ATLASSERT(m_hDC != NULL);
return ::LPtoDP(m_hDC, (LPPOINT)lpRect, 2);
}
BOOL LPtoDP(LPSIZE lpSize) const
{
SIZE sizeWinExt = { 0, 0 };
if(!GetWindowExt(&sizeWinExt))
return FALSE;
SIZE sizeVpExt = { 0, 0 };
if(!GetViewportExt(&sizeVpExt))
return FALSE;
lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeVpExt.cx), abs(sizeWinExt.cx));
lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeVpExt.cy), abs(sizeWinExt.cy));
return TRUE;
}
// Special Coordinate Functions (useful for dealing with metafiles and OLE)
#define HIMETRIC_INCH 2540 // HIMETRIC units per inch
void DPtoHIMETRIC(LPSIZE lpSize) const
{
ATLASSERT(m_hDC != NULL);
int nMapMode;
if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT)
{
// when using a constrained map mode, map against physical inch
((CDCHandle*)this)->SetMapMode(MM_HIMETRIC);
DPtoLP(lpSize);
((CDCHandle*)this)->SetMapMode(nMapMode);
}
else
{
// map against logical inch for non-constrained mapping modes
int cxPerInch = GetDeviceCaps(LOGPIXELSX);
int cyPerInch = GetDeviceCaps(LOGPIXELSY);
ATLASSERT(cxPerInch != 0 && cyPerInch != 0);
lpSize->cx = ::MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch);
lpSize->cy = ::MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch);
}
}
void HIMETRICtoDP(LPSIZE lpSize) const
{
ATLASSERT(m_hDC != NULL);
int nMapMode;
if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT)
{
// when using a constrained map mode, map against physical inch
((CDCHandle*)this)->SetMapMode(MM_HIMETRIC);
LPtoDP(lpSize);
((CDCHandle*)this)->SetMapMode(nMapMode);
}
else
{
// map against logical inch for non-constrained mapping modes
int cxPerInch = GetDeviceCaps(LOGPIXELSX);
int cyPerInch = GetDeviceCaps(LOGPIXELSY);
ATLASSERT(cxPerInch != 0 && cyPerInch != 0);
lpSize->cx = ::MulDiv(lpSize->cx, cxPerInch, HIMETRIC_INCH);
lpSize->cy = ::MulDiv(lpSize->cy, cyPerInch, HIMETRIC_INCH);
}
}
void LPtoHIMETRIC(LPSIZE lpSize) const
{
LPtoDP(lpSize);
DPtoHIMETRIC(lpSize);
}
void HIMETRICtoLP(LPSIZE lpSize) const
{
HIMETRICtoDP(lpSize);
DPtoLP(lpSize);
}
#endif // !_WIN32_WCE
// Region Functions
BOOL FillRgn(HRGN hRgn, HBRUSH hBrush)
{
ATLASSERT(m_hDC != NULL);
return ::FillRgn(m_hDC, hRgn, hBrush);
}
#ifndef _WIN32_WCE
BOOL FrameRgn(HRGN hRgn, HBRUSH hBrush, int nWidth, int nHeight)
{
ATLASSERT(m_hDC != NULL);
return ::FrameRgn(m_hDC, hRgn, hBrush, nWidth, nHeight);
}
BOOL InvertRgn(HRGN hRgn)
{
ATLASSERT(m_hDC != NULL);
return ::InvertRgn(m_hDC, hRgn);
}
BOOL PaintRgn(HRGN hRgn)
{
ATLASSERT(m_hDC != NULL);
return ::PaintRgn(m_hDC, hRgn);
}
#endif // !_WIN32_WCE
// Clipping Functions
int GetClipBox(LPRECT lpRect) const
{
ATLASSERT(m_hDC != NULL);
return ::GetClipBox(m_hDC, lpRect);
}
int GetClipRgn(CRgn& region) const
{
ATLASSERT(m_hDC != NULL);
if(region.IsNull())
region.CreateRectRgn(0, 0, 0, 0);
int nRet = ::GetClipRgn(m_hDC, region);
if(nRet != 1)
region.DeleteObject();
return nRet;
}
#ifndef _WIN32_WCE
BOOL PtVisible(int x, int y) const
{
ATLASSERT(m_hDC != NULL);
return ::PtVisible(m_hDC, x, y);
}
BOOL PtVisible(POINT point) const
{
ATLASSERT(m_hDC != NULL);
return ::PtVisible(m_hDC, point.x, point.y);
}
#endif // !_WIN32_WCE
BOOL RectVisible(LPCRECT lpRect) const
{
ATLASSERT(m_hDC != NULL);
return ::RectVisible(m_hDC, lpRect);
}
int SelectClipRgn(HRGN hRgn)
{
ATLASSERT(m_hDC != NULL);
return ::SelectClipRgn(m_hDC, (HRGN)hRgn);
}
int ExcludeClipRect(int x1, int y1, int x2, int y2)
{
ATLASSERT(m_hDC != NULL);
return ::ExcludeClipRect(m_hDC, x1, y1, x2, y2);
}
int ExcludeClipRect(LPCRECT lpRect)
{
ATLASSERT(m_hDC != NULL);
return ::ExcludeClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
}
#ifndef _WIN32_WCE
int ExcludeUpdateRgn(HWND hWnd)
{
ATLASSERT(m_hDC != NULL);
return ::ExcludeUpdateRgn(m_hDC, hWnd);
}
#endif // !_WIN32_WCE
int IntersectClipRect(int x1, int y1, int x2, int y2)
{
ATLASSERT(m_hDC != NULL);
return ::IntersectClipRect(m_hDC, x1, y1, x2, y2);
}
int IntersectClipRect(LPCRECT lpRect)
{
ATLASSERT(m_hDC != NULL);
return ::IntersectClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
}
#ifndef _WIN32_WCE
int OffsetClipRgn(int x, int y)
{
ATLASSERT(m_hDC != NULL);
return ::OffsetClipRgn(m_hDC, x, y);
}
int OffsetClipRgn(SIZE size)
{
ATLASSERT(m_hDC != NULL);
return ::OffsetClipRgn(m_hDC, size.cx, size.cy);
}
int SelectClipRgn(HRGN hRgn, int nMode)
{
ATLASSERT(m_hDC != NULL);
return ::ExtSelectClipRgn(m_hDC, hRgn, nMode);
}
#endif // !_WIN32_WCE
// Line-Output Functions
#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
BOOL GetCurrentPosition(LPPOINT lpPoint) const
{
ATLASSERT(m_hDC != NULL);
return ::GetCurrentPositionEx(m_hDC, lpPoint);
}
BOOL MoveTo(int x, int y, LPPOINT lpPoint = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::MoveToEx(m_hDC, x, y, lpPoint);
}
BOOL MoveTo(POINT point, LPPOINT lpPointRet = NULL)
{
ATLASSERT(m_hDC != NULL);
return MoveTo(point.x, point.y, lpPointRet);
}
BOOL LineTo(int x, int y)
{
ATLASSERT(m_hDC != NULL);
return ::LineTo(m_hDC, x, y);
}
BOOL LineTo(POINT point)
{
ATLASSERT(m_hDC != NULL);
return LineTo(point.x, point.y);
}
#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
#ifndef _WIN32_WCE
BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
ATLASSERT(m_hDC != NULL);
return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4);
}
BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
{
ATLASSERT(m_hDC != NULL);
return ::Arc(m_hDC, lpRect->left, lpRect->top,
lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
ptEnd.x, ptEnd.y);
}
#endif // !_WIN32_WCE
BOOL Polyline(LPPOINT lpPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::Polyline(m_hDC, lpPoints, nCount);
}
#ifndef _WIN32_WCE
BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle)
{
ATLASSERT(m_hDC != NULL);
return ::AngleArc(m_hDC, x, y, nRadius, fStartAngle, fSweepAngle);
}
BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
ATLASSERT(m_hDC != NULL);
return ::ArcTo(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4);
}
BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
{
ATLASSERT(m_hDC != NULL);
return ArcTo(lpRect->left, lpRect->top, lpRect->right,
lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y);
}
int GetArcDirection() const
{
ATLASSERT(m_hDC != NULL);
return ::GetArcDirection(m_hDC);
}
int SetArcDirection(int nArcDirection)
{
ATLASSERT(m_hDC != NULL);
return ::SetArcDirection(m_hDC, nArcDirection);
}
BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::PolyDraw(m_hDC, lpPoints, lpTypes, nCount);
}
BOOL PolylineTo(const POINT* lpPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -