www.pudn.com > my2cadtest07261930.rar > SetPenAttr.h, change:2006-07-26,size:2302b


 
#ifndef _setpenattr_ 
#define _setpenattr_ 
 
#include <windows.h> 
#include <commdlg.h> 
#include "resource.h" 
#include <stdio.h> 
 
extern HWND g_hwnd; 
 
class CSetPenAttr   
{ 
public:	 
	CSetPenAttr();  
	virtual ~CSetPenAttr(); 
 
public:    
	void ReleaseBrush(bool isredrawpen=true); 
	void ReleasePen(bool whatpen,bool isredrawpen=true); //删除划笔 whatpen标识删除哪只笔 
    void GetBrush(HDC &hdc,bool isredrawpen=true); 
    void GetPen(HDC &hdc,bool whatpen,bool isredrawpen=true);   //获得划笔 
 
public: 
	static bool CALLBACK PenDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); //对话框窗口处理过程 
    int PenAttribDlg(HINSTANCE &hInst,HWND &hWnd);    //调出设置对话框 
    void OnInitDialog(HWND &hwnd, LPARAM &lParam);    //初始化 
    void OnCtlColorStatic(WPARAM &wParam, LPARAM &lParam); 
	void OnOk(); 
    bool GetPenColor(HWND &hwnd); 
    bool GetBgColor(HWND &hwnd); 
public: 
	 
	LOGPEN GetPenStyle(bool drawpen=true) 
	{  
	if(drawpen)	 
		{ 
			return m_redraw_penstruct; 
        } 
		else 
		{ 
			return m_penstruct; 
		} 
		 
	}; 
	LOGBRUSH GetBrushStyle(bool drawbursh=true) 
	{ 
		if(drawbursh)	 
		{ 
			return m_redraw_brushstruct; 
        } 
		else 
		{ 
			return m_brushstruct; 
		} 
		 
	}; 
 
    void SetPenStyle(LOGPEN &logPen) 
	{ m_redraw_penstruct.lopnColor=logPen.lopnColor; 
      m_redraw_penstruct.lopnStyle=logPen.lopnStyle; 
      m_redraw_penstruct.lopnWidth.x=logPen.lopnWidth.x; 
 	}; 
 
     void SetBrushStyle(LOGBRUSH &logBrush) 
	{ m_redraw_brushstruct.lbColor=logBrush.lbColor; 
      m_redraw_brushstruct.lbStyle=logBrush.lbStyle; 
      m_redraw_brushstruct.lbHatch=logBrush.lbHatch; 
	}; 
	 
private: 
      
   HWND m_hPenColor; 
   HWND m_hBgColor; 
   HWND m_hWnd; 
   HWND m_hPenWidth; 
   HWND m_hCBO; 
    
   CHOOSECOLOR	m_cDlgStruct;		//划笔颜色对话框结构 
   CHOOSECOLOR	m_cDlgStruct1;      //背景颜色对话框结构 
   COLORREF	m_cCustomColors[8]; 
 
   HPEN m_orpen;              //异或划笔 
    
   HPEN m_pen;                //画图划笔 
   HBRUSH m_brush; 
   LOGPEN  m_penstruct; 
   LOGBRUSH m_brushstruct; 
 
   HPEN m_redrawPen;          //重绘划笔(7.22) 
   HBRUSH m_redrawBrush; 
   LOGPEN  m_redraw_penstruct; 
   LOGBRUSH m_redraw_brushstruct; 
 
public: 
   COLORREF m_bgcolor; 
}; 
    
 
 
#endif