MFC命名规则(转)
MFC命名规则
Windows类型 |
样本变量 |
MFC类 |
样本变量 |
HWND |
hWnd; |
CWnd* |
pWnd; |
HDLG |
hDlg; |
CDialog* |
pDlg; |
HDC |
hDC; |
CDC* |
pDC; |
HGDIOBJ |
hGdiObj; |
CGdiObject* |
pGdiObj; |
HPEN |
hPen; |
CPen* |
pPen; |
HBRUSH |
hBrush; |
CBrush* |
pBrush; |
HFONT |
hFont; |
CFont* |
pFont; |
HBITMAP |
hBitmap; |
CBitmap* |
pBitmap; |
HPALETTE |
hPaltte; |
CPalette* |
pPalette; |
HRGN |
hRgn; |
CRgn* |
pRgn; |
HMENU |
hMenu; |
CMenu* |
pMenu; |
HWND |
hCtl; |
CState* |
pState; |
HWND |
hCtl; |
CButton* |
pButton; |
HWND |
hCtl; |
CEdit* |
pEdit; |
HWND |
hCtl; |
CListBox* |
pListBox; |
HWND |
hCtl; |
CComboBox* |
pComboBox; |
HWND |
hCtl; |
CScrollBar* |
pScrollBar; |
HSZ |
hszStr; |
CString |
pStr; |
POINT |
pt; |
CPoint |
pt; |
SIZE |
size; |
CSize |
size; |
RECT |
rect; |
CRect |
rect; |
还有一点想说明一下:
常量和宏定义必须全部以大写字母来撰写,中间可根据意义的连续性用下划线连接,每一条定义的右侧必须有一简单的注释,说明其作用;
下面是vc资源名字定义格式:
菜单: IDM_XX //M:Menu
位图: IDB_XX //B:Bitmap
对话框: IDD_XX //D:Dialog
字符串: IDS_XX //S:String
ICON: IDI_XX //I:Icon
按钮控件: IDC_BTN_XX //BTN:Button
编辑控件: IDC_EDT_XX //EDT:EditBox
列表控件: IDC_LST_XX //LST:ListCtrl
树表控件: IDC_TRE_XX //TRE:TreeCtrl
富文本控件: IDC_RCH_XX //RCH:RichEdit
静态本控件: IDC_STT_XX //STT:StaticText
组合框控件: IDC_CMB_XX //CMB:ComboBox
滚动条控件: IDC_SCR_XX //SCR:ScrollBar
滑动条控件: IDC_SLD_XX //SLD:Slider
多选项控件: IDC_CHK_XX //CHK:CheckBox
单选项控件: IDC_RDB_XX //RDB:RadioButton