?? atlgdi.h
字號:
return ::PtVisible(m_hDC, x, y);
}
BOOL PtVisible(POINT point) const
{
ATLASSERT(m_hDC != NULL);
return ::PtVisible(m_hDC, point.x, point.y);
}
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);
}
int ExcludeUpdateRgn(HWND hWnd)
{
ATLASSERT(m_hDC != NULL);
return ::ExcludeUpdateRgn(m_hDC, hWnd);
}
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);
}
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);
}
// Line-Output Functions
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);
}
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);
}
BOOL Polyline(LPPOINT lpPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::Polyline(m_hDC, lpPoints, nCount);
}
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);
return ::PolylineTo(m_hDC, lpPoints, nCount);
}
BOOL PolyPolyline(const POINT* lpPoints,
const DWORD* lpPolyPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::PolyPolyline(m_hDC, lpPoints, lpPolyPoints, nCount);
}
BOOL PolyBezier(const POINT* lpPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::PolyBezier(m_hDC, lpPoints, nCount);
}
BOOL PolyBezierTo(const POINT* lpPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::PolyBezierTo(m_hDC, lpPoints, nCount);
}
// Simple Drawing Functions
BOOL FillRect(LPCRECT lpRect, HBRUSH hBrush)
{
ATLASSERT(m_hDC != NULL);
return ::FillRect(m_hDC, lpRect, hBrush);
}
BOOL FillRect(LPCRECT lpRect, int nColorIndex)
{
ATLASSERT(m_hDC != NULL);
return ::FillRect(m_hDC, lpRect, (HBRUSH)LongToPtr(nColorIndex + 1));
}
BOOL FrameRect(LPCRECT lpRect, HBRUSH hBrush)
{
ATLASSERT(m_hDC != NULL);
return ::FrameRect(m_hDC, lpRect, hBrush);
}
BOOL InvertRect(LPCRECT lpRect)
{
ATLASSERT(m_hDC != NULL);
return ::InvertRect(m_hDC, lpRect);
}
BOOL DrawIcon(int x, int y, HICON hIcon)
{
ATLASSERT(m_hDC != NULL);
return ::DrawIcon(m_hDC, x, y, hIcon);
}
BOOL DrawIcon(POINT point, HICON hIcon)
{
ATLASSERT(m_hDC != NULL);
return ::DrawIcon(m_hDC, point.x, point.y, hIcon);
}
BOOL DrawIconEx(int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL)
{
ATLASSERT(m_hDC != NULL);
return ::DrawIconEx(m_hDC, x, y, hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
}
BOOL DrawIconEx(POINT point, HICON hIcon, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL)
{
ATLASSERT(m_hDC != NULL);
return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
}
BOOL DrawState(POINT pt, SIZE size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hBitmap, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_BITMAP);
}
BOOL DrawState(POINT pt, SIZE size, HICON hIcon, UINT nFlags, HBRUSH hBrush = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_ICON);
}
BOOL DrawState(POINT pt, SIZE size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags | (bPrefixText ? DST_PREFIXTEXT : DST_TEXT));
}
BOOL DrawState(POINT pt, SIZE size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, HBRUSH hBrush = NULL)
{
ATLASSERT(m_hDC != NULL);
return ::DrawState(m_hDC, hBrush, lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_COMPLEX);
}
// Ellipse and Polygon Functions
BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
ATLASSERT(m_hDC != NULL);
return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4);
}
BOOL Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
{
ATLASSERT(m_hDC != NULL);
return ::Chord(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y);
}
void DrawFocusRect(LPCRECT lpRect)
{
ATLASSERT(m_hDC != NULL);
::DrawFocusRect(m_hDC, lpRect);
}
BOOL Ellipse(int x1, int y1, int x2, int y2)
{
ATLASSERT(m_hDC != NULL);
return ::Ellipse(m_hDC, x1, y1, x2, y2);
}
BOOL Ellipse(LPCRECT lpRect)
{
ATLASSERT(m_hDC != NULL);
return ::Ellipse(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
}
BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
ATLASSERT(m_hDC != NULL);
return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4);
}
BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
{
ATLASSERT(m_hDC != NULL);
return ::Pie(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y);
}
BOOL Polygon(LPPOINT lpPoints, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::Polygon(m_hDC, lpPoints, nCount);
}
BOOL PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount)
{
ATLASSERT(m_hDC != NULL);
return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount);
}
BOOL Rectangle(int x1, int y1, int x2, int y2)
{
ATLASSERT(m_hDC != NULL);
return ::Rectangle(m_hDC, x1, y1, x2, y2);
}
BOOL Rectangle(LPCRECT lpRect)
{
ATLASSERT(m_hDC != NULL);
return ::Rectangle(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
}
BOOL RoundRect(int x1, int y1, int x2, int y2, int x3, int y3)
{
ATLASSERT(m_hDC != NULL);
return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3);
}
BOOL RoundRect(LPCRECT lpRect, POINT point)
{
ATLASSERT(m_hDC != NULL);
return ::RoundRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, point.x, point.y);
}
// Bitmap Functions
BOOL PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop)
{
ATLASSERT(m_hDC != NULL);
return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop);
}
BOOL BitBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC,
int xSrc, int ySrc, DWORD dwRop)
{
ATLASSERT(m_hDC != NULL);
return ::BitBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, dwRop);
}
BOOL StretchBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop)
{
ATLASSERT(m_hDC != NULL);
return ::StretchBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwRop);
}
COLORREF GetPixel(int x, int y) const
{
ATLASSERT(m_hDC != NULL);
return ::GetPixel(m_hDC, x, y);
}
COLORREF GetPixel(POINT point) const
{
ATLASSERT(m_hDC != NULL);
return ::GetPixel(m_hDC, point.x, point.y);
}
COLORREF SetPixel(int x, int y, COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::SetPixel(m_hDC, x, y, crColor);
}
COLORREF SetPixel(POINT point, COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::SetPixel(m_hDC, point.x, point.y, crColor);
}
BOOL FloodFill(int x, int y, COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::FloodFill(m_hDC, x, y, crColor);
}
BOOL ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType)
{
ATLASSERT(m_hDC != NULL);
return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType);
}
BOOL MaskBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, HBITMAP hMaskBitmap, int xMask, int yMask, DWORD dwRop)
{
ATLASSERT(m_hDC != NULL);
return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, hMaskBitmap, xMask, yMask, dwRop);
}
BOOL PlgBlt(LPPOINT lpPoint, HDC hSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, HBITMAP hMaskBitmap, int xMask, int yMask)
{
ATLASSERT(m_hDC != NULL);
return ::PlgBlt(m_hDC, lpPoint, hSrcDC, xSrc, ySrc, nWidth, nHeight, hMaskBitmap, xMask, yMask);
}
BOOL SetPixelV(int x, int y, COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::SetPixelV(m_hDC, x, y, crColor);
}
BOOL SetPixelV(POINT point, COLORREF crColor)
{
ATLASSERT(m_hDC != NULL);
return ::SetPixelV(m_hDC, point.x, point.y, crColor);
}
#ifndef _ATL_NO_MSIMG
BOOL AlphaBlend(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BLENDFUNCTION bf)
{
ATLASSERT(m_hDC != NULL);
return ::AlphaBlend(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf);
}
BOOL TransparentBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent)
{
ATLASSERT(m_hDC != NULL);
return ::TransparentBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent);
}
BOOL GradientFill(const PTRIVERTEX pVertices, DWORD nVertices, void* pMeshElements, DWORD nMeshElements, DWORD dwMode)
{
ATLASSERT(m_hDC != NULL);
return ::GradientFill(m_hDC, pVertices, nVertices, pMeshElements, nMeshElements, dwMode);
}
#endif //!_ATL_NO_MSIMG
// Extra bitmap functions
// Helper function for painting a disabled toolbar or menu bitmap
// This function can take either an HBITMAP (for SS) or a DC with
// the bitmap already painted (for cmdbar)
BOOL DitherBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, HBITMAP hBitmap, int xSrc, int ySrc,
HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE),
HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT),
HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW))
{
ATLASSERT(m_hDC != NULL || hBitmap != NULL);
ATLASSERT(nWidth > 0 && nHeight > 0);
// Create a generic DC for all BitBlts
CDCHandle dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC);
ATLASSERT(dc.m_hDC != NULL);
if(dc.m_hDC == NULL)
return FALSE;
// Create a DC for the monochrome DIB section
CDC dcBW = ::CreateCompatibleDC(m_hDC);
ATLASSERT(dcBW.m_hDC != NULL);
if(dcBW.m_hDC == NULL)
{
if(hSrcDC == NULL)
dc.DeleteDC();
return FALSE;
}
// Create the monochrome DIB section with a black and white palette
struct RGBBWBITMAPINFO
{
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[2];
};
RGBBWBITMAPINFO rgbBWBitmapInfo =
{
{ sizeof(BITMAPINFOHEADER), nWidth, nHeight, 1, 1, BI_RGB, 0, 0, 0, 0, 0 },
{ { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 } }
};
VOID* pbitsBW;
CBitmap bmpBW = ::CreateDIBSection(dcBW, (LPBITMAPINFO)&rgbBWBitmapInfo, DIB_RGB_COLORS, &pbitsBW, NULL, 0);
ATLASSERT(bmpBW.m_hBitmap != NULL);
if(bmpBW.m_hBitmap == NULL)
{
if(hSrcDC == NULL)
dc.DeleteDC();
return FALSE;
}
// Attach the monochrome DIB section and the bitmap to the DCs
HBITMAP hbmOldBW = dcBW.SelectBitmap(bmpBW);
HBITMAP hbmOldDC = NULL;
if(hBitmap != NULL)
hbmOldDC = dc.SelectBitmap(hBitmap);
// Block: Dark gray removal: we want (128, 128, 128) pixels to become black and not white
{
CDC dcTemp1 = ::CreateCompatibleDC(m_hDC);
CDC dcTemp2 = ::CreateCompatibleDC(m_hDC);
CBitmap bmpTemp1;
bmpTemp1.CreateCompatibleBitmap(dc, nWidth, nHeight);
CBitmap bmpTemp2;
bmpTemp2.CreateBitmap(nWidth, nHeight, 1, 1, NULL);
HBITMAP hOldBmp1 = dcTemp1.SelectBitmap(bmpTemp1);
HBITMAP hOldBmp2 = dcTemp2.SelectBitmap(bmpTemp2);
// Let's copy our image, it will be altered
dcTemp1.BitBlt(0, 0, nWidth, nHeight, dc, xSrc, ySrc, SRCCOPY);
// All dark gray pixels will become white, the others black
dcTemp1.SetBkColor(RGB(128, 128, 128));
dcTemp2.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY);
// Do an XOR to set to black these white pixels
dcTemp1.BitBlt(0, 0, nWidth, nHeight, dcTemp2, 0, 0, SRCINVERT);
// BitBlt the bitmap into the monochrome DIB section
// The DIB section will do a true monochrome conversion
// The magenta background being closer to white will become white
dcBW.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY);
// Cleanup
dcTemp1.SelectBitmap(hOldBmp1);
dcTemp2.SelectBitmap(hOldBmp2);
}
// Paint the destination rectangle using hBrushBackground
RECT rc = { x, y, x + nWidth, y + nHeight };
FillRect(&rc, hBrushBackground);
// BitBlt the black bits in the monochrome bitmap into hBrush3DEffect color in the destination DC
// The magic ROP comes from the Charles Petzold's book
HBRUSH hOldBrush = SelectBrush(hBrush3DEffect);
BitBlt(x + 1, y + 1, nWidth, nHeight, dcBW, 0, 0, 0xB8074A);
// BitBlt the black bits in the monochrome bitmap into hBrushDisabledImage color in the destination DC
SelectBrush(hBrushDisabledImage);
BitBlt(x, y, nWidth, nHeight, dcBW, 0, 0, 0xB8074A);
SelectBrush(hOldBrush);
dcBW.SelectBitmap(hbmOldBW);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -