📄 fractaldialog.cpp
字号:
// FractalDialog.cpp : implementation file
//
#include "stdafx.h"
#include "FractalEx.h"
#include "FractalDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFractalDialog dialog
CFractalDialog::CFractalDialog(CWnd* pParent /*=NULL*/)
: CDialog(CFractalDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CFractalDialog)
m_origin = _T("");
m_expression = _T("");
tempor = FALSE;
m_name = _T("custom");
//}}AFX_DATA_INIT
}
void CFractalDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFractalDialog)
DDX_Control(pDX, IDC_LIST1, m_list);
DDX_Text(pDX, IDC_EDIT3, m_origin);
DDX_Text(pDX, IDC_EDIT1, m_expression);
DDX_Check(pDX, IDC_CHECK1, tempor);
DDX_Text(pDX, IDC_EDIT4, m_name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFractalDialog, CDialog)
//{{AFX_MSG_MAP(CFractalDialog)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFractalDialog message handlers
void CFractalDialog::OnOK()
{
UpdateData();
CDialog::OnOK();
}
void CFractalDialog::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
CPoint pt;
GetCursorPos(&pt);
m_list.ScreenToClient(&pt);
int n=m_list.HitTest(pt);
if(n>=0)
{
UpdateData();
m_expression=m_list.GetItemText(n, 0);
m_origin=m_list.GetItemText(n, 1);
UpdateData(FALSE);
}
*pResult = 0;
}
BOOL CFractalDialog::OnInitDialog()
{
CDialog::OnInitDialog();
const static int nsample=10;
const static char sample[nsample][2][50]={
{"z*z+z0", "0"},
{"(z^3)+z0", "0"},
{"(z^4)+z0", "0"},
{"(z^5)+z0", "0"},
{"(z^9)+z0", "0"},
{"z*z+Z(-0.1,0.4)", "z0"},
{"z*z+Z(0.4, 0.3)", "z0"},
{"z*z+0.56667-z/2", "z0"},
{"z*z*z-z", "z0"},
{"z*z*z+Z(-0.6,0.4)", "z0"},
};
m_list.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
m_list.InsertColumn(0, "表达式", LVCFMT_LEFT, 200);
m_list.InsertColumn(1, "初值", LVCFMT_LEFT, 100);
for(int i=0;i<nsample;i++)
{
m_list.InsertItem(i, sample[i][0]);
m_list.SetItemText(i, 1, sample[i][1]);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFractalDialog::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{
CPoint pt;
GetCursorPos(&pt);
m_list.ScreenToClient(&pt);
if(m_list.HitTest(pt)>=0)
OnOK();
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -