I have added an OnPaint() function to my dialog class but its not getting called after dlg.DoModal()
问题 Can anyone please help me understand how to override OnPaint() for a dialog class derived from CDialog . Here is the code: ColorImageDlg *pDlg = NULL; pDlg = new ColorImageDlg; pDlg->DoModal(); delete pDlg; I'm overriding OnInitDialog() and it's getting called. But while overriding OnPaint() it is not getting called. Can any one please help me fixing it? 回答1: First of all what is the point of creating the instance of the dialog on heap? You can simply do: ColorImageDlg dlg; dlg.DoModal(); You