void CBBCDlg: : OnBnClickedCheck1 ()
{show="show";
PMFrame=(CMainFrame *) GetParentFrame ();
PMFrame - & gt; The show=show;
PMFrame - & gt; Invalidate ().
//TODO: add the control notification handler code
}
Draw a member function of a class
void CDrawView: : ontouch * pDC (CDC)
{
CDocument * pDoc=GetDocument ();
//TODO: add in this rendering code
PMFrame=(CMainFrame *) GetParentFrame ();
PMFrame - & gt; The show=show;
Cstrings STR=pMFrame - & gt; The show;
MessageBox (STR);
//pMFrame - & gt; Invalidate ().
If (show=="show")
{DrawCoordinate (pDC, 3);
}
}
Without errors, how to realize the data sharing between them? Drawing class show value is not equal to dialogue in the class show.
Great god help me, this is my curriculum design problems, next week will reply, thank you
CodePudding user response:
Use a custom message to share dataCodePudding user response:
It is recommended to use global variablesCodePudding user response:
In stdafx.in the CPPCstrings show=_T (" ");
In stdafx.
in the hExtern cstrings show;
A global variable with respect to OK
You for the broken dick program can be simplified as
void CBBCDlg: : OnBnClickedCheck1 ()
{
The show="show";
GetParentFrame () - & gt; Invalidate ().
}
Void CDrawView: : ontouch * pDC (CDC)
{
CDocument * pDoc=GetDocument ();
MessageBox (show);
If (show=="show")
{
DrawCoordinate (pDC, 3);
}
}
CodePudding user response:
Are you a single document or multiple document?CodePudding user response:
Global variables to go,CodePudding user response:
In addition, said a problem, you old man's house in ontouch MessageBox is dead