关于mfc小问题?
本帖最后由 VisualEleven 于 2012-10-27 14:24:54 编辑
void CMainFrame::OnOpenFile()
{
CString filename; // 通过对话框选取文件并获得文件名
CFileDialog file(true);
file.DoModal();
filename = file.GetFileName();
CStdioFile doc;// 打开文件
doc.Open(filename,CFile::modeRead|CFile::shareDenyWrite,NULL);
CString a; // 读取文件内容
int b[4];
for (int i=0;i<4;i++)
{
doc.ReadString(a);
a.Format("%d",b[i]);
}
CPudgeDoc* pDoc = (CPudgeDoc*)GetActiveDocument();
pDoc->a = b[0];
pDoc->b = b[1];
pDoc->c = b[2];
pDoc->d = b[4];
CPudgeView* pView = (CPudgeView*)GetActiveView();
pView->Invalidate(true);
// TODO: Add your command handler code here
}
我能问下我这段代码最后重绘了么
我的CPudgeDoc中的成员变量有数值了么
新手求详细解答 非常感谢!
[解决办法]
CPudgeDoc里面的结构我们看不到啊
把赋值那边加上断点。然后F11可以进去查看。或者在watch表格中跟踪变量内容。
pView->Invalidate(true);
触发View的OnPaint重绘函数了。你里面有没有相关的代码呢?
每天坚持回复1帖就有10分,另外每周超过10贴回复,再送30分。
或者注册小号。