If (nResponse==IDOK)//to judge whether the return value is the OK button (the ID for the IDOK, chicken peck rice has been deleted it)
{
//TODO: Place code here to handle the when the dialog is
//dismissed with OK
}
Else if (nResponse==IDCANCEL)//whether the return value for the Cancel button (the ID is IDCANCEL, chicken peck rice will change its Caption to "exit")
{
//TODO: Place code here to handle the when the dialog is
//dismissed with Cancel
}
The else
{
The CWnd * pPictureWnd=GetDlgItem (IDC_PICTRUE1);
The CDC * pDC=GetDlgItem (IDC_PICTRUE1) - & gt; GetDC ();
CRect rc;
GetDlgItem (IDC_PICTRUE1) - & gt; GetClientRect (rc);
PDC - & gt; MoveTo (10, 10);
PDC - & gt; The LineTo (100, 10);
PDC - & gt; MoveTo (10, 10);
PDC - & gt; The LineTo (10, 100);
PPictureWnd - & gt; The ReleaseDC (pDC);
}
CodePudding user response:
The original dialog box dialog box opens in the son, window is covered by child dialogs, child dialogs ok after the original dialog window need to redraw theIDC_PICTRUE1 DC is invalid, can add RedrawWindow (), so that DC (effective) of the client area effectively, again:
RedrawWindow ();//to redraw the original dialog make IDC_PICTRUE1 DC effective
The CWnd * pPictureWnd=GetDlgItem (IDC_PICTRUE1);
The CDC * pDC=pPictureWnd> GetDC ();
CRect rc;
PPictureWnd - & gt; GetClientRect (rc);
CodePudding user response:
I just learn vs programming just for a few days, there are many don't understand the question,Can you tell me where I add code button response function in the pop-up dialog right? Judge what is the code in the if?
DLG CMyDialog1 *;
DLG=new CMyDialog1 (this);
INT_PTR nResponse=DLG - & gt; DoModal ();
If (nResponse==IDOK)//to judge whether the return value is the OK button (the ID for the IDOK, chicken peck rice has been deleted it)
{
//TODO: Place code here to handle the when the dialog is
//dismissed with OK
}
Else if (nResponse==IDCANCEL)//whether the return value for the Cancel button (the ID is IDCANCEL, chicken peck rice will change its Caption to "exit")
{
//TODO: Place code here to handle the when the dialog is
//dismissed with Cancel
}
CodePudding user response:
"The pop-up dialog box to add code?"The
2 buttons on the dialog box of OK and Cancel
If (nResponse==IDOK) means that the user press the OK button
CodePudding user response:
But in child dialog button response function I also added a code, the code and the if (nResponse==IDOK) can exist at the same time?CodePudding user response:
In the dialog box button I also added a of the code from the response functionYou can but don't damage the return value is
Void CxxxxDlg: : OnOK ()
{
//TODO: Add extra validation here
You add code;
CDialog: : OnOK ();
}
CodePudding user response:
Put your drawing code in the OnPaint function to do `CodePudding user response: