📄 tdc.h
字号:
// TDC.h: interface for the TDC class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_TDC_H__9B3516AA_85FF_11D5_B10B_C55DF8D77E35__INCLUDED_)
#define AFX_TDC_H__9B3516AA_85FF_11D5_B10B_C55DF8D77E35__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/*
class TPoint
{
public:
int x,y;
};
class TSize
{
public:
int cx, cy;
};
class TRect
{
public:
int top,left,bottom,right;
};
class TPen {public: int temp;};
class TBrush{public: int temp;};
class TFont {public: int temp;};
//*/
class TDC
{
//DECLARE_DYNCREATE(TDC)
public:
TDC(HWND h);
TDC(HDC hdc);
void Setup();
~TDC();
HDC m_hDC;
HWND m_hWnd;
bool m_bFromDC;
public:
HFONT m_Font;
HPEN m_Pen;
public:
void MoveTo(int x,int y);
void LineTo(int x,int y);
void TextOut(int x,int y,const char*text,int nChar=-1);
void TextOut(POINT p,const char*text,int nChar=-1){TextOut(p.x,p.y,text,nChar);};;
int SetROP2(int nDrawMode);
void FillRect(RECT&r, COLORREF color);
void FillRect(int l,int t,int r,int b, COLORREF color);
void SetTextColor(COLORREF color);
void SetTextBkColor(COLORREF color);
void SetFont(int size,char *fontname);
void SetPen(int color,int w=1,unsigned int style=PS_SOLID);
HGDIOBJ SelectObject(HGDIOBJ obj);
SIZE GetTextExtent(LPCTSTR lpszString, int nCount=-1);
/*---------------------------------
// Attributes
HDC m_hAttribDC; // The Attribute DC
operator HDC() const;
HDC GetSafeHdc() const; // Always returns the Output DC
//CWnd* GetWindow() const;
static TDC* 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
//TPen* GetCurrentPen() const;
//TBrush* GetCurrentBrush() const;
//CPalette* GetCurrentPalette() const;
//TFont* GetCurrentFont() const;
//CBitmap* GetCurrentBitmap() const;
// for bidi and mirrored localization
DWORD GetLayout() const;
DWORD SetLayout(DWORD dwLayout);
// Constructors
BOOL CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName,
LPCTSTR lpszOutput, const void* lpInitData);
BOOL CreateIC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName,
LPCTSTR lpszOutput, const void* lpInitData);
//BOOL CreateCompatibleDC(TDC* 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
//TPoint GetBrushOrg() const;
//TPoint SetBrushOrg(int x, int y);
//TPoint SetBrushOrg(POINT point);
int EnumObjects(int nObjectType,
int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData);
// Type-safe selection helpers
public:
//virtual CGdiObject* SelectStockObject(int nIndex);
//TPen* SelectObject(TPen* pPen);
//TBrush* SelectObject(TBrush* pBrush);
//virtual TFont* SelectObject(TFont* pFont);
//CBitmap* SelectObject(CBitmap* pBitmap);
//int SelectObject(CRgn* pRgn); // special return for regions
// 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 SetStretchBltMode(int nStretchMode);
virtual COLORREF SetTextColor(COLORREF crColor);
BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const;
BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust);
// Mapping Functions
int GetMapMode() const;
TPoint GetViewportOrg() const;
virtual int SetMapMode(int nMapMode);
// Viewport Origin
virtual TPoint SetViewportOrg(int x, int y);
TPoint SetViewportOrg(POINT point);
virtual TPoint OffsetViewportOrg(int nWidth, int nHeight);
// Viewport Extent
TSize GetViewportExt() const;
virtual TSize SetViewportExt(int cx, int cy);
TSize SetViewportExt(SIZE size);
virtual TSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
// Window Origin
TPoint GetWindowOrg() const;
TPoint SetWindowOrg(int x, int y);
TPoint SetWindowOrg(POINT point);
TPoint OffsetWindowOrg(int nWidth, int nHeight);
// Window extent
TSize GetWindowExt() const;
virtual TSize SetWindowExt(int cx, int cy);
TSize SetWindowExt(SIZE size);
virtual TSize 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, TBrush* pBrush);
//BOOL FrameRgn(CRgn* pRgn, TBrush* 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
TPoint GetCurrentPosition() const;
TPoint MoveTo(int x, int y);
TPoint 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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -