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

📄 clrfiledialog.cpp

📁 二维规则网格数据的等值线追踪
💻 CPP
字号:
// ClrFileDialog.cpp : implementation file
//

#include "stdafx.h"
#include "ContourGenerator.h"
#include "ColorLookUpTable.h"
#include "ClrFileDialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// CClrFileDialog

IMPLEMENT_DYNAMIC(CClrFileDialog, CFileDialog)

CClrFileDialog::CClrFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
		DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
		CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
		// if OFN_ENABLETEMPLATE is set, define the custom dialog template here
		m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILECOLORTMP_DIALOG);
}


BEGIN_MESSAGE_MAP(CClrFileDialog, CFileDialog)
	//{{AFX_MSG_MAP(CClrFileDialog)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

void CClrFileDialog::DrawColorSpectrum()
{
	CWnd *pWnd=GetDlgItem(IDC_STATIC_PREVIEW);
	CDC *pDC=pWnd->GetDC();
	CRect rect;
	pWnd->GetClientRect(&rect);
	
	m_ColorTable.DrawColorSpectrum(pDC,rect);
	
	pWnd->ReleaseDC(pDC);
	
}

void CClrFileDialog::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	DrawColorSpectrum();	
}

BOOL CClrFileDialog::OnInitDialog()
{
	CFileDialog::OnInitDialog();
	
	m_ofn.hInstance = AfxGetInstanceHandle();
	
	return TRUE;
}

void CClrFileDialog::OnFileNameChange()
{
	m_ColorTable.LoadColorTable(GetPathName());
	DrawColorSpectrum();

	CFileDialog::OnFileNameChange();

}

⌨️ 快捷键说明

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