You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <Gdiplus.h>
class AFX_EXT_CLASS CXyDCBase :
public CSXY
{
public:
CXyDCBase(void);
virtual ~CXyDCBase(void);
public:
virtual int Create(CDC* pDC, BOOL bSetViewRect = TRUE);
virtual void Clear(void);
//生成与恢复必须成对出现
virtual int CreatePenOrBrush(double PenWidth, COLORREF color, int type, BOOL bSmooth, BOOL bCreate);
virtual void CreateSelectPen(double PenWidth, COLORREF color, int type, UINT nStyle=PS_ENDCAP_FLAT|PS_JOIN_MITER, BOOL bSmooth=TRUE);
virtual BOOL CreateSelectBrush(COLORREF color, int type);
void RestorePen(); //恢复DC中的Pen
void RestoreBrush(); //恢复DC中的Brush
void SelectPen(); //将已生成的Pen选择进入指定的DC中
void SelectBrush(); //将已生成的Bursh选择进入指定的DC中
virtual void DeletePen(void); //删除已生成的Pen
virtual void DeleteBrush(void); //删除已生成的Brush
void RestorePenPlus(); //恢复DC中的Pen
void RestoreBrushPlus(); //恢复DC中的Brush
//void SelectPenPlus();
virtual void SetCurrentLayer(LPCTSTR strLayer); //为了扩展用在该类中没有用到在CDxfDC中用到
virtual void SetCurrentColor(COLORREF colValue);
virtual COLORREF GetCurrentColor();
virtual void SetCurrentPenWidth(double penWidth);
virtual COLORREF GetCurrentBrushColor();
//生成与恢复必须成对出现
virtual BOOL CreateSelectFontRange(LOGFONT& lf);
virtual BOOL CreateSelectFontDraw(LOGFONT& lf);
void RestoreFont();
void SelectFontRange();
void SelectFontDraw();
void DeleteFontRange(void);
void DeleteFontDraw(void);
void operator=(CXyDCBase& dc);
void SetNullBrush(); //设置为空刷子
void SetBlackPen(); //设置为黑笔
private:
void CreatePen(int nPenWidth, COLORREF crColor, int type, UINT nStyle=PS_ENDCAP_FLAT|PS_JOIN_MITER, BOOL bSmooth=TRUE);
BOOL CreateBrush(COLORREF color, int type);
void CreatePenPlus();
void CreateBrushPlus();
public:
bool m_gdiplusInitialized = false;
Gdiplus::Pen m_penPlus;
Gdiplus::SolidBrush m_brushPlus;
COLORREF m_symbolBackcolor = 16777216;
COLORREF m_symbolForecolor = 16777216;
protected:
CPen m_pen;
CBrush m_brush;
int m_nPenRes;
int m_nBrushRes;
CPen* m_pOldPen;
CBrush* m_pOldBrush;
int oldRop2;
LOGFONT m_logFontRange;
LOGFONT m_logFontDraw;
CFont m_fontRange;
CFont m_fontDraw;
CFont* m_pOldFont;
private:
//刷子或画笔的参数保存
COLORREF m_brushColor;
int m_brushType;
COLORREF m_brushColorOld;
int m_brushTypeOld { 0 };
COLORREF m_penColor;
int m_penWidth;
int m_penType;
UINT m_penStyle;
BOOL m_penSmooth;
COLORREF m_penColorOld;
int m_penWidthOld{ 1 };
int m_penTypeOld { 0 };
UINT m_penStyleOld;
BOOL m_penSmoothOld;
public:
virtual int CreatePenOrBrush1(double PenWidth, COLORREF color, int type, BOOL bSmooth, BOOL bCreate, int nStyleCount = 0, DWORD* lpStyle = NULL); //ggff2025
virtual void CreateSelectPen1(double PenWidth, COLORREF color, int type, UINT nStyle = PS_ENDCAP_FLAT | PS_JOIN_MITER, BOOL bSmooth = TRUE, int nStyleCount = 0, DWORD* lpStyle = NULL); //ggff2025
private:
void CreatePen1(int nPenWidth, COLORREF crColor, int type, UINT nStyle = PS_ENDCAP_FLAT | PS_JOIN_MITER, BOOL bSmooth = TRUE, int nStyleCount = 0, DWORD* lpStyle = NULL);
int m_penStyleCount; //ggff2025
DWORD* m_penLpStyle; //ggff2025
};