mycolorpalettebar.cpp

来自「在编写图形程序」· C++ 代码 · 共 66 行

CPP
66
字号
// MyColorPaletteBar.cpp : implementation file
//

#include "stdafx.h"
#include "CustomTool.h"
#include "MyColorPaletteBar.h"
#include "mainfrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyColorPaletteBar

CMyColorPaletteBar::CMyColorPaletteBar()
{
}

CMyColorPaletteBar::~CMyColorPaletteBar()
{
}


BEGIN_MESSAGE_MAP(CMyColorPaletteBar, CFOColorPaletteDialogBar)
	//{{AFX_MSG_MAP(CMyColorPaletteBar)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CMyColorPaletteBar message handlers
void CMyColorPaletteBar::OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL /*bDisableIfNoHndler*/)
{
	CFrameWnd *pParent = STATIC_DOWNCAST(CFrameWnd,AfxGetMainWnd());
	ASSERT_VALID(pParent);
	COLORREF crTemp;
	COLORREF crBack;
	COLORREF crLine;
	CFODrawView* pView = (CFODrawView*)(pParent->GetActiveFrame()->GetActiveView());
	if(pView != NULL)
	{
		if (pView->GetColorAndPositionAtCursor(crBack,crTemp,crLine))
		{
			SetColors(crLine,crBack);
		}
	}
}

void CMyColorPaletteBar::OnColorChange(COLORREF crColor,BOOL bLine)
{
	CFrameWnd *pParent = STATIC_DOWNCAST(CFrameWnd,AfxGetMainWnd());
	ASSERT_VALID(pParent);
	CFODrawView* pView = (CFODrawView*)(pParent->GetActiveFrame()->GetActiveView());
	if(pView != NULL)
	{
		FO_COLOR *m_color = new FO_COLOR;
		m_color->crText = m_crText;
		m_color->crBack = m_crBack;
		pView->SendMessage(WM_FO_COLORHASCHANGED,(WPARAM)m_color);
	}
}

⌨️ 快捷键说明

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