1.程序运行后是一个对话框,对话框上有画布,颜色粗细等按钮
2.单击画布后能够创建一个SDI,然后再单击颜色粗细按钮能够在SDI上绘图
3.程序运行过程中对话框始终存在。我目前使用的方法是,创建一个基于对话框的程序,另外手动添加了CMainFrame,CODDoc,CODView来构建SDI结构
在App类的InitInstance函数中代码如下:BOOL CODApp::InitInstance()
{ #ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) //初始化为模态对话框, 创建MenuDlg
CMenuDlg dlg;
int nResponse=dlg.DoModal();
if(nResponse==IDOK)
{}
else if(nResponse==IDCANCEL)
{}
return TRUE;
}用来在程序初始时创建对话框
然后我在CMenuDlg类里有如下函数:BOOL CMenuDlg::OnButtonFull()
{ CODApp* app=(CODApp*)AfxGetApp();
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CODDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CODView));
app->AddDocTemplate(pDocTemplate);
CCommandLineInfo cmdInfo;
app->ParseCommandLine(cmdInfo);
if (!app->ProcessShellCommand(cmdInfo))
return FALSE;
return TRUE;
}即在按下画板按钮后能够创建SDI结构来绘图;
虽然编译通过,但是在运行时总是出现各种各样的小Bug。
我想请教各位高手,有没有更好的方法来实现以上功能,谢谢了!在线等!
2.单击画布后能够创建一个SDI,然后再单击颜色粗细按钮能够在SDI上绘图
3.程序运行过程中对话框始终存在。我目前使用的方法是,创建一个基于对话框的程序,另外手动添加了CMainFrame,CODDoc,CODView来构建SDI结构
在App类的InitInstance函数中代码如下:BOOL CODApp::InitInstance()
{ #ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) //初始化为模态对话框, 创建MenuDlg
CMenuDlg dlg;
int nResponse=dlg.DoModal();
if(nResponse==IDOK)
{}
else if(nResponse==IDCANCEL)
{}
return TRUE;
}用来在程序初始时创建对话框
然后我在CMenuDlg类里有如下函数:BOOL CMenuDlg::OnButtonFull()
{ CODApp* app=(CODApp*)AfxGetApp();
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CODDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CODView));
app->AddDocTemplate(pDocTemplate);
CCommandLineInfo cmdInfo;
app->ParseCommandLine(cmdInfo);
if (!app->ProcessShellCommand(cmdInfo))
return FALSE;
return TRUE;
}即在按下画板按钮后能够创建SDI结构来绘图;
虽然编译通过,但是在运行时总是出现各种各样的小Bug。
我想请教各位高手,有没有更好的方法来实现以上功能,谢谢了!在线等!
为什么一定要用sdi,用dialog加上菜单,背景设成白色就可以
或者向ls说的建个sdi程序,在app的InitInstance函数中添加个非模式对话框,只要在sdi生成前建就好
毕竟自己写sdi还是挺麻烦的
另外什么叫响应空闲时间?