📄 otherfractaldialog.cpp
字号:
// OtherFractalDialog.cpp : implementation file
//
#include "stdafx.h"
#include "FractalEx.h"
#include "OtherFractalDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COtherFractalDialog dialog
COtherFractalDialog::COtherFractalDialog(CWnd* pParent /*=NULL*/)
: CDialog(COtherFractalDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(COtherFractalDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
SelectedLib="";
}
void COtherFractalDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COtherFractalDialog)
DDX_Control(pDX, IDC_LIST1, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COtherFractalDialog, CDialog)
//{{AFX_MSG_MAP(COtherFractalDialog)
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COtherFractalDialog message handlers
BOOL COtherFractalDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_list.InsertColumn(0, "名称", LVCFMT_LEFT, 100);
m_list.InsertColumn(1, "表达式", LVCFMT_LEFT, 100);
m_list.InsertColumn(2, "初值", LVCFMT_LEFT, 100);
m_list.InsertColumn(3, "文件名", LVCFMT_LEFT, 100);
m_list.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
CFileFind cfd;
CString filename;
int i=0, reali;
BOOL found=cfd.FindFile(LibPath+"*.dll");
while(found)
{
found=cfd.FindNextFile();
FractalData* data=NULL;
filename=cfd.GetFileName();
HMODULE hlib=LoadLibrary(LibPath+filename);
if(hlib)
{
_GetFractalData getdata=(_GetFractalData)GetProcAddress(hlib, "GetFractalData");
if(getdata)
data=getdata();
}
if(data&&data->tempor)
{
reali=m_list.InsertItem(i, data->name);
m_list.SetItemText(reali, 1, data->expression);
m_list.SetItemText(reali, 2, data->origin);
m_list.SetItemText(reali, 3, filename);
i++;
}
if(hlib)
FreeLibrary(hlib);
}
cfd.Close();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COtherFractalDialog::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{
CPoint pt;
GetCursorPos(&pt);
m_list.ScreenToClient(&pt);
int n=m_list.HitTest(pt);
if(n>=0)
OnOK();
*pResult = 0;
}
void COtherFractalDialog::OnOK()
{
POSITION pos=m_list.GetFirstSelectedItemPosition();
if(pos)
{
int n=m_list.GetNextSelectedItem(pos);
SelectedLib=LibPath+m_list.GetItemText(n, 3);
}
else
{
MessageBox("没有选择!");
return;
}
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -