- UID
- 3375
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-3-28
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我定义了一个线型Y.SHX, 作为防护林用。 下面代码把Y.LIN在对话框中显示, 但如何根据对话框中修改值来存盘?
y.lin is as followed:
*YYL1,F2 circle
A,0,[CIRC2,Y.shx,s=1],-50
//The following is the code of diaplaying and editing y.lin
#include "stdafx.h"
#include "MyExam07Dlg.h"
#include "exam07.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// MyExam07Dlg dialog
MyExam07Dlg::MyExam07Dlg(CWnd* pParent /*=NULL*/)
: CAcUiDialog(MyExam07Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(MyExam07Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void MyExam07Dlg::DoDataExchange(CDataExchange* pDX)
{
CAcUiDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MyExam07Dlg)
DDX_Control(pDX, IDC_EDIT_YPT, m_ctrlYPtEdit);
DDX_Control(pDX, IDC_EDIT_XPT, m_ctrlXPtEdit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MyExam07Dlg, CAcUiDialog)
//{{AFX_MSG_MAP(MyExam07Dlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// MyExam07Dlg message handlers
BOOL MyExam07Dlg::OnInitDialog()
{
SetDialogName("exam07:MyExam07Dlg");
CAcUiDialog::OnInitDialog();
DLGCTLINFO dlgSizeInfo[]= {
{ IDC_STATIC_GROUP1, ELASTICX, 20 },
{ IDC_STATIC_GROUP1, ELASTICY, 100 },
{ IDC_EDIT_XPT,ELASTICX, 20 },
{ IDC_EDIT_YPT,ELASTICX, 20 },
{ IDC_STATIC_GROUP3, MOVEY, 100 },
{ IDC_STATIC_GROUP3, ELASTICX, 20 },
{ IDOK,MOVEX, 100 },
{ IDCANCEL, MOVEX, 100 },
};
const DWORD numberofentries =
sizeof dlgSizeInfo / sizeof DLGCTLINFO;
SetControlProperty(dlgSizeInfo, numberofentries);
DisplayPoint();
SetWindowText("Forrest Lines");
return TRUE;
}
void MyExam07Dlg::OnOK()
{ FILE *fp;
if ((fp=fopen("y.lin","w"))==0) {
acutPrintf("cannot open file \n");
return;
}
fclose(fp);
CAcUiDialog::OnOK();
}
void MyExam07Dlg::DisplayPoint()
{ FILE *fp;
if ((fp=fopen("y.lin","r"))==0) {
acutPrintf("cannot open file \n");
return;
}
//AfxMessageBox("m_str");
/*
acutPrintf("%c fir\n", getc(fp));
acutPrintf("%c fir\n", getc(fp));
acutPrintf("%c fir\n", getc(fp));*/
m_str=getc(fp);
acutPrintf("%s first\n", m_str);
while (m_str != EOF) {
if (m_str == '=') {
m_strXPt=getc(fp);
ch=getc(fp);
while (ch != ']' ) {
m_strXPt=m_strXPt+ch;
ch=getc(fp);
}
}
if (m_str == '-') {
m_strYPt=getc(fp);
ch=getc(fp);
while (ch !=EOF) {
m_strYPt=m_strYPt+ch;
ch=getc(fp);
}
}
m_str=getc(fp);
}
acutPrintf("%s radius\n", m_strXPt);
acutPrintf("%s offset\n", m_strYPt);
/*
m_strXPt=getc(fp);
if (m_strXPt = "*") m_strXPt=getc(fp);
m_strXPt+=getc(fp);
m_strYPt=getc(fp);
*/
m_ctrlXPtEdit.SetWindowText(m_strXPt);
m_ctrlXPtEdit.Convert();
m_ctrlYPtEdit.SetWindowText(m_strYPt);
m_ctrlYPtEdit.Convert();
fclose(fp);
} |
|