在View类中动态创建一个Edit控件如下:editT1.Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,CRect(0,0,50,20),this, IDC_EDITT1);现在想实现类似对话框中的数据交换功能。我的方法是:
void CMatlabPrintView::DoDataExchange(CDataExchange* pDX)
{
// TODO: Add your specialized code here and/or call the base class
CView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMatlabPrintView)
DDX_Text(pDX, IDC_EDITT1, m_dT1);
//}}AFX_DATA_MAP
}可是没有效果,怎么回事呀?谢谢。
void CMatlabPrintView::DoDataExchange(CDataExchange* pDX)
{
// TODO: Add your specialized code here and/or call the base class
CView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMatlabPrintView)
DDX_Text(pDX, IDC_EDITT1, m_dT1);
//}}AFX_DATA_MAP
}可是没有效果,怎么回事呀?谢谢。
解决方案 »
- 循序渐进实现仿QQ界面(一):园角矩形与双缓冲贴图窗口
- 关于Visual stdio 6.0 执行的问题!
- 有没有考虑过IBM笔记本上的振动检测软件。。。。什么原理? 讨论一下。。。
- 为什么运算结果不一样呢?望高人指点
- WM_SETCURSOR的问题
- VDM和WOW是什么
- 新手上路,请赐教阿
- mfc打印一维码。
- 为什么我用TerminateProcess杀不了WIN95,WIN98的进程,是我的问题还是TerminateProcess是在WIN95,WIN98下的用法不同???
- 如何使TCS_HOTTRACK生效?
- 写数据库,内存会耗进?
- 百分求 在vs2003中的安装部署中怎样将卸载程序添加到菜单中
editT1.SetWindowText( m_dT1 );
editT1.GetWindowText( m_dT1 );
我的DoDataExchange是要在class CMatlabPrintView : public CView中实现的
能直接拖放控件到View类中吗?怎么弄呀?int CMatlabPrintView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
editT1.Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
CRect(T1x,T1y,T1x+30,T1y+20),this, IDC_EDITT1); return 0;
}
void CMatlabPrintView::DoDataExchange(CDataExchange* pDX)
{
// TODO: Add your specialized code here and/or call the base class
CView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMatlabPrintView) DDX_Text(pDX, IDC_EDITT1, m_dT1); //}}AFX_DATA_MAP
}
_____________________________________________________________________________
我同意着个说法,所以我的做法是:
在初始化(OnInitDialog())函数里加:
editT1 = new CEdit();//要加这条语句
editT1->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE
| WS_TABSTOP | WS_BORDER,CRect(0,0,50,20),this, IDC_EDITT1);
在函数的开头声名一个全局的控件变量:CEdit *editT1;
在函数的其他地方使用editT1去处理这个edit,如:editT1->SetWindowText("edit");