?? afxwin.h
字號:
BOOL operator!=(const CGdiObject& obj) const;
// Implementation
public:
virtual ~CGdiObject();
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
virtual void AssertValid() const;
#endif
};
/////////////////////////////////////////////////////////////////////////////
// CGdiObject subclasses (drawing tools)
class CPen : public CGdiObject
{
DECLARE_DYNAMIC(CPen)
public:
static CPen* PASCAL FromHandle(HPEN hPen);
// Constructors
CPen();
CPen(int nPenStyle, int nWidth, COLORREF crColor);
CPen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush,
int nStyleCount = 0, const DWORD* lpStyle = NULL);
BOOL CreatePen(int nPenStyle, int nWidth, COLORREF crColor);
BOOL CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush,
int nStyleCount = 0, const DWORD* lpStyle = NULL);
BOOL CreatePenIndirect(LPLOGPEN lpLogPen);
// Attributes
operator HPEN() const;
int GetLogPen(LOGPEN* pLogPen);
int GetExtLogPen(EXTLOGPEN* pLogPen);
// Implementation
public:
virtual ~CPen();
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
#endif
};
class CBrush : public CGdiObject
{
DECLARE_DYNAMIC(CBrush)
public:
static CBrush* PASCAL FromHandle(HBRUSH hBrush);
// Constructors
CBrush();
CBrush(COLORREF crColor); // CreateSolidBrush
CBrush(int nIndex, COLORREF crColor); // CreateHatchBrush
CBrush(CBitmap* pBitmap); // CreatePatternBrush
BOOL CreateSolidBrush(COLORREF crColor);
BOOL CreateHatchBrush(int nIndex, COLORREF crColor);
BOOL CreateBrushIndirect(const LOGBRUSH* lpLogBrush);
BOOL CreatePatternBrush(CBitmap* pBitmap);
BOOL CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage);
BOOL CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage);
BOOL CreateSysColorBrush(int nIndex);
// Attributes
operator HBRUSH() const;
int GetLogBrush(LOGBRUSH* pLogBrush);
// Implementation
public:
virtual ~CBrush();
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
#endif
};
class CFont : public CGdiObject
{
DECLARE_DYNAMIC(CFont)
public:
static CFont* PASCAL FromHandle(HFONT hFont);
// Constructors
CFont();
BOOL CreateFontIndirect(const LOGFONT* lpLogFont);
BOOL CreateFont(int nHeight, int nWidth, int nEscapement,
int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
LPCTSTR lpszFacename);
BOOL CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, CDC* pDC = NULL);
BOOL CreatePointFontIndirect(const LOGFONT* lpLogFont, CDC* pDC = NULL);
// Attributes
operator HFONT() const;
int GetLogFont(LOGFONT* pLogFont);
// Implementation
public:
virtual ~CFont();
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
#endif
};
class CBitmap : public CGdiObject
{
DECLARE_DYNAMIC(CBitmap)
public:
static CBitmap* PASCAL FromHandle(HBITMAP hBitmap);
// Constructors
CBitmap();
BOOL LoadBitmap(LPCTSTR lpszResourceName);
BOOL LoadBitmap(UINT nIDResource);
BOOL LoadOEMBitmap(UINT nIDBitmap); // for OBM_/OCR_/OIC_
BOOL LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0,
LPCOLORMAP lpColorMap = NULL, int nMapSize = 0);
BOOL CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitcount,
const void* lpBits);
BOOL CreateBitmapIndirect(LPBITMAP lpBitmap);
BOOL CreateCompatibleBitmap(CDC* pDC, int nWidth, int nHeight);
BOOL CreateDiscardableBitmap(CDC* pDC, int nWidth, int nHeight);
// Attributes
operator HBITMAP() const;
int GetBitmap(BITMAP* pBitMap);
// Operations
DWORD SetBitmapBits(DWORD dwCount, const void* lpBits);
DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const;
CSize SetBitmapDimension(int nWidth, int nHeight);
CSize GetBitmapDimension() const;
// Implementation
public:
virtual ~CBitmap();
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
#endif
};
class CPalette : public CGdiObject
{
DECLARE_DYNAMIC(CPalette)
public:
static CPalette* PASCAL FromHandle(HPALETTE hPalette);
// Constructors
CPalette();
BOOL CreatePalette(LPLOGPALETTE lpLogPalette);
BOOL CreateHalftonePalette(CDC* pDC);
// Attributes
operator HPALETTE() const;
int GetEntryCount();
UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
LPPALETTEENTRY lpPaletteColors) const;
UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
LPPALETTEENTRY lpPaletteColors);
// Operations
void AnimatePalette(UINT nStartIndex, UINT nNumEntries,
LPPALETTEENTRY lpPaletteColors);
UINT GetNearestPaletteIndex(COLORREF crColor) const;
BOOL ResizePalette(UINT nNumEntries);
// Implementation
virtual ~CPalette();
};
class CRgn : public CGdiObject
{
DECLARE_DYNAMIC(CRgn)
public:
static CRgn* PASCAL FromHandle(HRGN hRgn);
operator HRGN() const;
// Constructors
CRgn();
BOOL CreateRectRgn(int x1, int y1, int x2, int y2);
BOOL CreateRectRgnIndirect(LPCRECT lpRect);
BOOL CreateEllipticRgn(int x1, int y1, int x2, int y2);
BOOL CreateEllipticRgnIndirect(LPCRECT lpRect);
BOOL CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode);
BOOL CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts,
int nCount, int nPolyFillMode);
BOOL CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3);
BOOL CreateFromPath(CDC* pDC);
BOOL CreateFromData(const XFORM* lpXForm, int nCount,
const RGNDATA* pRgnData);
// Operations
void SetRectRgn(int x1, int y1, int x2, int y2);
void SetRectRgn(LPCRECT lpRect);
int CombineRgn(CRgn* pRgn1, CRgn* pRgn2, int nCombineMode);
int CopyRgn(CRgn* pRgnSrc);
BOOL EqualRgn(CRgn* pRgn) const;
int OffsetRgn(int x, int y);
int OffsetRgn(POINT point);
int GetRgnBox(LPRECT lpRect) const;
BOOL PtInRegion(int x, int y) const;
BOOL PtInRegion(POINT point) const;
BOOL RectInRegion(LPCRECT lpRect) const;
int GetRegionData(LPRGNDATA lpRgnData, int nCount) const;
// Implementation
virtual ~CRgn();
};
/////////////////////////////////////////////////////////////////////////////
// The device context
class CDC : public CObject
{
DECLARE_DYNCREATE(CDC)
public:
// Attributes
HDC m_hDC; // The output DC (must be first data member)
HDC m_hAttribDC; // The Attribute DC
operator HDC() const;
HDC GetSafeHdc() const; // Always returns the Output DC
CWnd* GetWindow() const;
static CDC* PASCAL FromHandle(HDC hDC);
static void PASCAL DeleteTempMap();
BOOL Attach(HDC hDC); // Attach/Detach affects only the Output DC
HDC Detach();
virtual void SetAttribDC(HDC hDC); // Set the Attribute DC
virtual void SetOutputDC(HDC hDC); // Set the Output DC
virtual void ReleaseAttribDC(); // Release the Attribute DC
virtual void ReleaseOutputDC(); // Release the Output DC
BOOL IsPrinting() const; // TRUE if being used for printing
CPen* GetCurrentPen() const;
CBrush* GetCurrentBrush() const;
CPalette* GetCurrentPalette() const;
CFont* GetCurrentFont() const;
CBitmap* GetCurrentBitmap() const;
// for bidi and mirrored localization
DWORD GetLayout() const;
DWORD SetLayout(DWORD dwLayout);
// Constructors
CDC();
BOOL CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName,
LPCTSTR lpszOutput, const void* lpInitData);
BOOL CreateIC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName,
LPCTSTR lpszOutput, const void* lpInitData);
BOOL CreateCompatibleDC(CDC* pDC);
BOOL DeleteDC();
// Device-Context Functions
virtual int SaveDC();
virtual BOOL RestoreDC(int nSavedDC);
int GetDeviceCaps(int nIndex) const;
UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags);
UINT GetBoundsRect(LPRECT lpRectBounds, UINT flags);
BOOL ResetDC(const DEVMODE* lpDevMode);
// Drawing-Tool Functions
CPoint GetBrushOrg() const;
CPoint SetBrushOrg(int x, int y);
CPoint SetBrushOrg(POINT point);
int EnumObjects(int nObjectType,
int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData);
// Type-safe selection helpers
public:
virtual CGdiObject* SelectStockObject(int nIndex);
CPen* SelectObject(CPen* pPen);
CBrush* SelectObject(CBrush* pBrush);
virtual CFont* SelectObject(CFont* pFont);
CBitmap* SelectObject(CBitmap* pBitmap);
int SelectObject(CRgn* pRgn); // special return for regions
CGdiObject* SelectObject(CGdiObject* pObject);
// CGdiObject* provided so compiler doesn't use SelectObject(HGDIOBJ)
// Color and Color Palette Functions
COLORREF GetNearestColor(COLORREF crColor) const;
CPalette* SelectPalette(CPalette* pPalette, BOOL bForceBackground);
UINT RealizePalette();
void UpdateColors();
// Drawing-Attribute Functions
COLORREF GetBkColor() const;
int GetBkMode() const;
int GetPolyFillMode() const;
int GetROP2() const;
int GetStretchBltMode() const;
COLORREF GetTextColor() const;
virtual COLORREF SetBkColor(COLORREF crColor);
int SetBkMode(int nBkMode);
int SetPolyFillMode(int nPolyFillMode);
int SetROP2(int nDrawMode);
int SetStretchBltMode(int nStretchMode);
virtual COLORREF SetTextColor(COLORREF crColor);
BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const;
BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust);
// Mapping Functions
int GetMapMode() const;
CPoint GetViewportOrg() const;
virtual int SetMapMode(int nMapMode);
// Viewport Origin
virtual CPoint SetViewportOrg(int x, int y);
CPoint SetViewportOrg(POINT point);
virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
// Viewport Extent
CSize GetViewportExt() const;
virtual CSize SetViewportExt(int cx, int cy);
CSize SetViewportExt(SIZE size);
virtual CSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
// Window Origin
CPoint GetWindowOrg() const;
CPoint SetWindowOrg(int x, int y);
CPoint SetWindowOrg(POINT point);
CPoint OffsetWindowOrg(int nWidth, int nHeight);
// Window extent
CSize GetWindowExt() const;
virtual CSize SetWindowExt(int cx, int cy);
CSize SetWindowExt(SIZE size);
virtual CSize ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom);
// Coordinate Functions
void DPtoLP(LPPOINT lpPoints, int nCount = 1) const;
void DPtoLP(LPRECT lpRect) const;
void DPtoLP(LPSIZE lpSize) const;
void LPtoDP(LPPOINT lpPoints, int nCount = 1) const;
void LPtoDP(LPRECT lpRect) const;
void LPtoDP(LPSIZE lpSize) const;
// Special Coordinate Functions (useful for dealing with metafiles and OLE)
void DPtoHIMETRIC(LPSIZE lpSize) const;
void LPtoHIMETRIC(LPSIZE lpSize) const;
void HIMETRICtoDP(LPSIZE lpSize) const;
void HIMETRICtoLP(LPSIZE lpSize) const;
// Region Functions
BOOL FillRgn(CRgn* pRgn, CBrush* pBrush);
BOOL FrameRgn(CRgn* pRgn, CBrush* pBrush, int nWidth, int nHeight);
BOOL InvertRgn(CRgn* pRgn);
BOOL PaintRgn(CRgn* pRgn);
// Clipping Functions
virtual int GetClipBox(LPRECT lpRect) const;
virtual BOOL PtVisible(int x, int y) const;
BOOL PtVisible(POINT point) const;
virtual BOOL RectVisible(LPCRECT lpRect) const;
int SelectClipRgn(CRgn* pRgn);
int ExcludeClipRect(int x1, int y1, int x2, int y2);
int ExcludeClipRect(LPCRECT lpRect);
int ExcludeUpdateRgn(CWnd* pWnd);
int IntersectClipRect(int x1, int y1, int x2, int y2);
int IntersectClipRect(LPCRECT lpRect);
int OffsetClipRgn(int x, int y);
int OffsetClipRgn(SIZE size);
int SelectClipRgn(CRgn* pRgn, int nMode);
// Line-Output Functions
CPoint GetCurrentPosition() const;
CPoint MoveTo(int x, int y);
CPoint MoveTo(POINT point);
BOOL LineTo(int x, int y);
BOOL LineTo(POINT point);
BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
BOOL Polyline(LPPOINT lpPoints, int nCount);
BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle);
BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
int GetArcDirection() const;
int SetArcDirection(int nArcDirection);
BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount);
BOOL PolylineTo(const POINT* lpPoints, int nCount);
BOOL PolyPolyline(const POINT* lpPoints,
const DWORD* lpPolyPoints, int nCount);
BOOL PolyBezier(const POINT* lpPoints, int nCount);
BOOL PolyBezierTo(const POINT* lpPoints, int nCount);
// Simple Drawing Functions
void FillRect(LPCRECT lpRect, CBrush* pBrush);
void FrameRect(LPCRECT lpRect, CBrush* pBrush);
void InvertRect(LPCRECT lpRect);
BOOL DrawIcon(int x, int y, HICON hIcon);
BOOL DrawIcon(POINT point, HICON hIcon);
#if (WINVER >= 0x400)
BOOL DrawState(CPoint pt, CSize size, HBITMAP hBitmap, UINT nFlags,
HBRUSH hBrush = NULL);
BOOL DrawState(CPoint pt, CSize size, CBitmap* pBitmap, UINT nFlags,
CBrush* pBrush = NULL);
BOOL DrawState(CPoint pt, CSize size, HICON hIcon, UINT nFlags,
HBRUSH hBrush = NULL);
BOOL DrawState(CPoint pt, CSize size, HICON hIcon, UINT nFlags,
CBrush* pBrush = NULL);
BOOL DrawState(CPoint pt, CSize size, LPCTSTR lpszText, UINT nFlags,
BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -