⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 focolorcellobj.h

📁 visual c++ 实例编程
💻 H
字号:
// Copyright UCanCode Software Technology Inc, All Rights Reserved
// You can contact us.
// Support@UCanCode.net
// http://www.ucancode.net
/********************************************************************/
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFC_FOCOLORCELLOBJ_H__F621A685_6C7E_11DF_A470_525400EA266C__INCLUDED_)
#define AFC_FOCOLORCELLOBJ_H__F621A685_6C7E_11DF_A470_525400EA266C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

  // Color change message.
#define WM_FO_SELECTCOLOROK					WM_USER+220	// Select color ok.
#define WM_FO_SELECTCOLORCANCEL				WM_USER+221	// Select color cancel.
#define WM_FO_SELECTCOLORCUSTOM				WM_USER+222	// Select color custom.
#define WM_FO_SELECTCOLORCHANGE				WM_USER+223 // Select color change.
  // Color picker alignment.
#define FO_ALIGNBOTTOMLEFT				0x0001	

// border shape
enum BorderShape 
{
	BORDER_NONE = 0,
	BORDER_SINGLE_IN,
	BORDER_SINGLE_OUT,
	BORDER_DOUBLE_IN,
	BORDER_DOUBLE_OUT,
	BORDER_SUNKEN,	
	BORDER_LOW,	
	BORDER_UP,	
	BORDER_HIGH,
	BORDER_FLAT,
	BORDER_FRAME,
	BORDER_LIGHT_FRAME,	
	BORDER_THIN_FRAME,
	BORDER_THIN_LIGHT_FRAME,
	BORDER_ETCHED,	
	BORDER_ETCHED2,	
	BORDER_SIMPLE
};	

struct FO_GLOBAL
{
	FO_GLOBAL();
	~FO_GLOBAL();

	// Button color.
	COLORREF m_crBtnFace;
	COLORREF m_crBtnHilite;
	COLORREF m_crBtnShadow;
	COLORREF m_crBtnText;
	COLORREF m_crBtnDkShadow;
	COLORREF m_crBtn3dShadow;
	COLORREF m_crBtn3dHiLight;
	COLORREF m_crBtnLight;
	COLORREF m_cr3dFace;
	COLORREF m_crAcCaption;
	COLORREF m_crInAcCaption;
	COLORREF m_crInAcCaptionText;
	COLORREF m_crDesktop;

	// Window color.
	COLORREF m_crWindowFrame;
	COLORREF m_crHilite;
	COLORREF m_crWindowText;

	// Text color.
	COLORREF m_crTextGrayed;
	COLORREF m_crTextHilite;
	COLORREF m_crTextHot;

	// Size of window.
	int m_cxEdge;
	int m_cyEdge;
	int m_cxBorder;

	// Screen size.
	int m_cxScreen;
	int m_cyScreen;

	// Scroll size.
	int m_cxVScroll;

	// Frame size.
	int m_cxFrame;
	int m_cyFrame;

	int m_cxFixedFrame;

	// Is nt.
	BOOL	bNT4;
	int		m_nBitsPerPixel;

	CSize GetScreenDimensions();

	void OnUpdateMetrics();

	void OnSysColorChange();
};

extern FO_GLOBAL gfxData;
class CFOColorCellObj : public CObject
{
protected:
	DECLARE_SERIAL(CFOColorCellObj);
public:

	// Constructor
	CFOColorCellObj();

	// Destructor
	virtual ~CFOColorCellObj();

	// Serialize data
	virtual void Serialize(CArchive &ar);

	// Hit Test
	virtual BOOL HitTest(CPoint point);

	// Creates a GDI brush object. The caller is responsible for freeing this memory! 
	CBrush* CreateBrush(CDC* pDC = NULL);

	// Returns a pointer to the cached GDI brush object. 
	CBrush* GetBrush(CDC* pDC = NULL);

	// Releases the cached brush object. 
	void RelaseBrushObject();

	// Creates GDI objects and sets up the device context for drawing.
	virtual void PrepareDC(CDC* pDC);

	// Draw
	virtual void OnDraw(CDC *pDC);

	// Draw Selected
	virtual void OnDrawSelect(CDC *pDC);

	// Frees GDI objects and restores the state of the device context.
	virtual void ClearDC(CDC* pDC);

	// Set Rectangle
	void	SetRect(const CRect &rcPos)			{ m_rcPosition = rcPos; }

	// Get Rectangle
	CRect	GetRect() const;

	// Set Cell Color
	void	SetCellColor(const COLORREF &cr);

	// Get Cell Color
	COLORREF GetCellColor() const				{ return m_crCell; }

	// Set Cell Border Size
	void SetCellBorderSize(const int nBorder)	{ nCellBorderSize = nBorder; }

	// Adjust cell position.
	virtual void AdjustCellPosition(int x, int y, int nWidth);

	// Set first type.
	void SetFirstType(const BOOL bFirst) {m_bAtFirstType = bFirst; }

	// Get more near point.
	int MoreNear(float fNear);

protected:

	// Position of the cell.
	CRect		m_rcPosition;

	// Current cell color.
	COLORREF	m_crCell;
	
	// Brush.
	CBrush*		m_pBrushCell;

	// Cell border size.
	int			nCellBorderSize;

	// Cell points.
	CPoint		m_Points[6];

	// Is first type.
	BOOL	m_bAtFirstType;
};

//Define type CTypedPtrList
typedef CTypedPtrList<CObList, CFOColorCellObj*> CFOColorCellObjList;

#endif // !defined(AFC_FOCOLORCELLOBJ_H__F621A685_6C7E_11DF_A470_525400EA266C__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -