VC++学习笔记(四)

类别:VC语言 点击:0 评论:0 推荐:

MessageBox Button Combination IDs:
MB_ABORTRETRYIGNORE Abort,Retry,Ignore
MB_OK   OK
MB_OKCANCEL  OK,Cancel
MB_RETRYCANCEL  Retry,Cancel
MB_YESNO  Yes,No
MB_YESNOCANCEL  Yes,No,Cancel

MessageBox Icon IDs:
MB_ICONINFORMATION Informational icon
MB_ICONQUESTION  Question mark icon
MB_ICONSTOP  Stop sign icon
MB_ICONEXCLAMATION Exclamation mark icion

MessageBox return value IDs:
IDABORT  Abort
IDRETRY  Retry
IDIGNORE Ignore
IDYES  Yes
IDNO  No
IDOK  OK
IDCANCEL Cancel

Common Dialog Classes:
CFileDialog  File selection
CFontDialog  Font selection
CColorDialog  Color selection
CPageSetupDialog Page setup for printing
CPrintDialog  Printing
CFindReplaceDialog Find and Replace

定制CFileDialog:可以通过对于属性m_ofn的设置,对其进行定制:
typedef struct tagOFN{
DWORD  lStructSize;
HWND  hwndOwner;
HINSTANCE hInstance;
LPCTSTR  lpstrFilter;
LPTSTR  lpstrCustomFilter;
DWORD  nMaxCustFilter;
DWORD  nFIlterIndex;
LPTSTR  lpstrFile;
DWORD  nMaxFile;
LPTSTR  lpstrFileTitle;
DWORD  nMaxFileTitle;
LPCTSTR  lpstrInitialDir;
LPCTSTR  lpstrTitle;
DWORD  Flags;
WORD  nFileOffset;
WORD  nFileExtension;
LPCTSTR  lpstrDefExt;
DWORD  lCustData;
LPOFNHOOKPROC lpfnHook;
LPCTSTR  lpTemplateName;
}OPENFILENAME;

The Pen Class:
CDC dc(this);
CPen lPen(PS_SOLID,1,RGB(0,0,0));
dc.SelectObject(&lPen);

The Brush Class:
CBrush lPatterBrush(HS_BDIAGONAL,RGB(0,0,255));
使用bitmap作为背景
CBitmap m_bmpBitmap;
m_bmpBitmap.LoadBitmap(IDB_MYBITMAP);
CBrush lBitmapBursh(&m_bmpBitmap);

The Bitmap Class:
在程序中添加图片的方法:
1.使用资源文件的id添加
2.使用ActiveX方式显示.
3.使用api
HBITMAP hBitmap=(HBITMAP)::LoadImage(AfxGetInstanceHandle(),m_sFileName,IMAGE_BITMAP,0,0,LR_LOADROMFILE|LR_CREATEIBSECTION);
m_bmpBitmap.Attach(hBitmap);//m_bmpBitmap是CBitmap型

一个DC是CDC类的四个子类:CpaintDC,CClientDC,CWindowDC和CMetaFileDC之一的一个实例.

本文地址:http://com.8s8s.com/it/it209.htm