子对话框调用主对话框函数的方法

来源:互联网 发布:编程经历帖子 编辑:程序博客网 时间:2024/05/17 07:36

在CImageArea类中调用CGIFJPGDlg类(主对话框类)的DrawSelectedImage函数:

1. 在CImageArea类的.cpp文件中includeCGIFJPGDlg类的头文件

#include "GIFJPGDlg.h"

 

2. 在要调用的函数中使用下面的语句:

void CImageArea::OnPaint()
{
 CPaintDC dc(this); // device context for painting
 // TODO: Add your message handler code here
 // Do not call CStatic::OnPaint() for painting messages

 CGIFJPGDlg*  pWnd = static_cast<CGIFJPGDlg*>(GetParent());
  pWnd->DrawSelectedImage();

}

 

0 0
原创粉丝点击