MFC中如何为一个对话框添加成员变量?
已经为该对话框建立一个名为Motor_Sl_Distance的类代码为://Motor_Sl_Distance. "stdafx.h"#include"基于特定道路资源供给的交通方式分担计算(MFC).h"#include"Motor_Sl_Distance.h"#ifdef_DEBUG#definenewDEBUG_NEW#undefTHIS_FILEstaticcharTHIS_FILE[]=__FILE__;#endif///////////////////////////////////////////////////////////////////////////////Motor_Sl_DistancedialogMotor_Sl_Distance::Motor_Sl_Distance(CWnd*pParent/*=NULL*/):CDialog(Motor_Sl_Distance::IDD,pParent){//{{AFX_DATA_INIT(Motor_Sl_Distance)m_Edit=0;//}}AFX_DATA_INIT}voidMotor_Sl_Distance::DoDataExchange(CDataExchange*pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(Motor_Sl_Distance)DDX_Control(pDX,IDC_OK,m_OK);DDX_Control(pDX,IDC_CANCEL,m_Cancel);DDX_Text(pDX,IDC_Motor_SL_Distance_Edit,m_Edit);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(Motor_Sl_Distance,CDialog)//{{AFX_MSG_MAP(Motor_Sl_Distance)ON_BN_CLICKED(IDC_OK,OnOk)ON_EN_CHANGE(IDC_Motor_SL_Distance_Edit,OnChangeMotorSLDistanceEdit)//}}AFX_MSG_MAPEND_MESSAGE_MAP()///////////////////////////////////////////////////////////////////////////////Motor_Sl_DistancemessagehandlersvoidMotor_Sl_Distance::OnOk(){// }voidMotor_Sl_Distance::OnChangeMotorSLDistanceEdit(){// ,thecontrolwillnot//sendthisnotificationunlessyouoverridetheCDialog::OnInitDialog()//functionandcallCRichEditCtrl().SetEventMask()//withtheENM_CHANGEflagORedintothemask.// }请问如果要为其添加一个成员变量,应该在哪儿声明?
在类的头文件里面添加 你上面好像有一个头文件是中文名字 以后最好不要用中文的 因为有些编译器不认 嘿嘿
答:很简单,你的问题在于只要分清楚变量和函数的区别就够了。 变量是一个值,例如:a,21,M这类的。函数是一个处理规则,比如说,开始是个什么,经过这个函数后,结果要...详情>>
问:挺简单的一C函数,不过我是初学者,暂时还不会写,请好心人多多帮忙!
答:int mystrlen(char *str) { int n = 0; while (*str) { n++; str++;} return n; } voi...详情>>