VC窗口类学习_第1页
VC窗口类学习_第2页
VC窗口类学习_第3页
VC窗口类学习_第4页
VC窗口类学习_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、孙鑫 C+ 教程 3CWnd: 表示一个窗口类,CWinApp :表示一个应用程序类,CMainFrame 类是 CTestView 类的父类,CTestApp 表示应用程序类,CMainFrame : 表示框架类,CTestView :表示是视图类 ,CTestDoc 表示文档类,Test” 这CAboutDlg 表示一个对话框类,该类可有可无,表示的是点击“帮助”弹出“关于 样一个窗口。 CDialog 是从 CWnd 派生而来的,因此也是一个窗口类 , CButton 类是从 CWnd 派生出来的,因此 CButton 也是一个窗口类。InitApplication() 内部初始化管理

2、m_pMainWnd-ShowWindow(SW_SHOW); 显示窗口 m_pMainWnd-UpdateWindow(); 更新窗口 CWinThread:Run 完成消息循环 无论是全局变量还是全局对象,都是在程序运行之前,即入口函数 main 函数执行之前,系 统就为其分配好了内存空间。 对于全局对象, 就需要调用构造函数去为该对象分配内存空间。当一个子类它的构造函数调用之前,需要先构造父类。CTestApp:CTestApp()/ TODO: add construction code here,/ Place all significant initialization in In

3、itInstance构造函数 CTestApp ()定义的全局对象 CTestApp theApp ,先执行全局对象,再调用构造 函数,最后执行 WinMain 函数。定义全局对象 CTestApp theApp 的目的和作用,以及在执行 main 函数之前调用的原因: theApp 为一应用程序对象,在 MFC 程序中有且仅有一个 CWinApp 派生出来的类 (CTestApp ),也只能有一个从应用程序类所实例化的对象,它( theApp )就表示了应用程序本身。因为定义了全局对象,就导致构造函数 CTestApp() 的调用 ,而 CTestApp 类是从 CWinApp 类派生出来的

4、,因此便导致了 CWinApp 类构造函数的调用,因此就把我们所定 义的派生类 CTestApp 和微软提供给我们的基类 CWinApp 关联起来了。在 CWinApp 当中 就对整个程序,包括运行之前初始化工作,在 CWinApp 的构造函数当中完成。设计窗口类,在 MFC 程序中已经由 MFC 设计好了,只是一个注册的问题。注册完成后就 要创建窗口,显示窗口,更新窗口,最后消息循环。注册窗口类的完成: AfxEndDeferRegisterClass(LONG fToRegister)在 MFC 中 已 经 预 先 为 我 们 定 义 好 了 几 种 默 认 的 窗 口 类 , 我 们 只

5、 需 调 用 AfxEndDeferRegisterClass(LONG fToRegister)该函数在运行时去注册就行,并且会根据我 们所创建的不同窗口类去注册。设计窗口类的完成:先执行全局对象 CTestApp theApp 启动程序, 再调用构造函数 CTestApp:CTestApp() , 接着是 WinMain() 函数,再到 BOOL CTestApp:InitInstance() , 再是注册窗口类 BOOL AFXAPI AfxEndDeferRegisterClass(LONGfToRegister), 接 着 是 BOOLCMainFrame:PreCreateWind

6、ow(CREATESTRUCT& cs) 。创建 CreateStruct 结构体, PreCreateWindow 是为了便于我们在子类当中在创建窗口之前让 我们有机会去修改窗口的外观。在 MFC 程序当中,文档视类结构视类指 View 类,文档指 Doc 类。比如 Word 里的数据存储和加载都由文档类来完成, 数据的显示和修改则由视类来完成, 这样就可以有效地把数据本身和数据处理、显示分开。CSingleDocTemplate* pDocTemplate;pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS

7、(CTestDoc), RUNTIME_CLASS(CMainFrame),/ main SDI frame windowRUNTIME_CLASS(CTestView);AddDocTemplate(pDocTemplate);单文档模板指针 CSingleDocTemplate* pDocTemplate,该指针应用一个 new将文档类、框 架类和视图类有机的组合在一起。再利用 AddDocTemplate(pDocTemplate) 函数将单文档模 板。CWnd 类有一个数据成员 m_hWnd ,保存了跟它相关窗口的一个句柄。因为所有的窗口类 都是从 CWnd 派生出来的,所以所有类的子

8、类内部都有一个 public 的数据成员,保存了跟 这对象相关的一个窗口类句柄。int CMainFrame:OnCreate(LPCREATESTRUCT lpCreateStruct) 是用来响应窗口创建消 息的一个函数。if (CFrameWnd:OnCreate(lpCreateStruct) = -1)return -1;先是调用基类的 CFrameWnd:OnCreate(lpCreateStruct) = -1 去创建窗口 ,接着是 创建工具栏和状态栏 。if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VI

9、SIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) |!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)TRACE0(Failed to create toolbarn);return -1; / fail to createif (!m_wndStatusBar.Create(this) |!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)TRACE0(Fai

10、led to create status barn);return -1; / fail to createButton 窗口的创建:方法一:可以将 Button 的创建 放在上述代码的后面,即在窗口、工具栏和状态栏创建好了 之后便可创建 Button 窗口,在返回 return 0; 之前:m_btn.Create( 确定 ,WS_CHILD | BS_DEFPUSHBUTTON,CRect(0, 0,100,100),this,123); m_btn.ShowWindow(SW_SHOWNORMAL);并且在工作区的 ClassView 中的 CMainFrame 处单击右键, 选择 Ad

11、d Member Variable ( 添 加成员变量),在变量类型中输入 CButton,在变量名称中输入 m_btn,在access中选择private, 单击确定即可。方法二:可以在工作区的 ClassView中的CTestView处单击右键,选择Add Windows Message Handler , 在新 建 Windows 消息 /事 件中 选择 WM_CREATE, 可以 看到消 息提 示 WM_CREATE:indicates that a window is being created ,选择 Add Handler,在已存在的消息 / 事件句柄 中显示了 WM_CREAT

12、E ,选择Edit Existing,在出现编辑代码处输入:m_btn.Create(确定 ”,WS_CHILD | BS_DEFPUSHBUTTON,CRect(0, 0,100,100),this,123); m_btn.ShowWindow(SW_SHOWNORMAL);并且在工作区的 ClassView中的ClassView处单击右键,选择 Add Member Variable (添加 成员变量),在变量类型中输入 CButton,在变量名称中输入 m_btn,在access中选择private, 单击确定即可。如果创建完 Button 后就立即想让它显示出来,则m_btn.Crea

13、te( 确 定 ,WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,CRect(0, 0,100,100),this,123);/ m_btn.ShowWindow(SW_SHOWNORMAL);WS_VISIBLE 可视化类型 , 该类型可以让 Button 一旦创建便可显示出来。单选框、多选框和平常看到的按钮在 MFC 中都是由一个类来表示,也就是 CButton 类。 当创建窗口时,由于指定的父窗口不同,则创建的窗口所摆放的位置也会不同。当获取父窗口时,可以调用GetPare nt()函数。m_btn.Create( 确 定 ,WS_CHILD | WS_

14、VISIBLE | BS_DEFPUSHBUTTON,CRect(0, 0,100,100),GetParent()/*this*/,123);/ m_btn.ShowWindow(SW_SHOWNORMAL);Button Styles BS_AUTOCHECKBOXSame as a check box, except that a check markappears in the check box whe n the user selects the box; the check mark disappears the n ext time the user selects the b

15、ox. BS_AUTORADIOBUTTONSame as a radio butt on, except that whe n theuser selects it, the butt on automatically highlights itself and removes theselection from any other radio buttons with the same style in the samegroup. BS_AUTO3STATE Same as a three-state check box, except that the boxcha nges its

16、state whe n the user selects it.* BS_CHECKBOX Creates a small square that has text displayed to its right(un less this style is combi ned with theBS_LEFTTEXT style).* BS_DEFPUSHBUTTONCreates a butt on that has a heavy black border.The user can select this butt on by press ing the ENTER key. This sty

17、le en ablesthe user to quickly select the most likely option (the default option).* BS_GROUPBOX Creates a recta ngle in which other butt ons can begrouped. Any text associated with this style is displayed in the rectangle supper-left corn er.* BS_LEFTTEXT When combi ned with a radio-butt on or check

18、-box style, thetext appears on the left side of the radio butt on or check box.* BS_OWNERDRAWCreates an own er-draw n butto n. The framework callsthe DrawItem member fun cti on whe n a visual aspect of the butt on hascha nged. This style must be set whe n using theCBitmapButt onclass.* BS_PUSHBUTTON

19、Creates a pushbutton that posts aWM_COMMANDmessage to the owner window whe n the user selects the butt on.* BS_RADIOBUTTONCreates a small circle that has text displayed to itsright (u nless this style is combi ned with theBS_LEFTTEXT style). Radiobutt ons are usually used in groups of related but mu

20、tually exclusive choices.* BS_3STATE Same as a check box, except that the box can be dimmed aswell as checked. The dimmed state typically is used to show that a check boxhas bee n disabled.See AlsoCButto n:Create孙鑫 C+ 教程 4MessageBox()中可以少一参数,也就是一个句柄,因为MessageBox是属于 CWnd 个类中的 成员函数 ,它不需要句柄,因为它有一个 数据成员

21、 保存了和该窗口相关的句柄。消息的捕获 :可在 视图类 CDrawView 或者 框架类 CMainFrame 中完成。消息响应函数 OnLButtonDown 。void CMainFrame: OnLButtonDown (UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultCFrameWnd:OnLButtonDown(nFlags, point);实现方法:在工作区的 ClassView 中的 CDrawView 处单击右键, 选择 Add Windows Mes

22、sage Handler ,在新建 Windows消息/事件中选择 WM_LButtonDown,选择 Add Handler,在已存 在的消息/事件句柄中显示了 WM_LButtonDown ,选择Edit Existing,在出现编辑代码处输 入:void CMainFrame:OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call default MessageBox(“View Clicked! ”);CFrameWnd:OnLButtonDown(nF

23、lags, point);在视图类 CDrawView 中实现了消息响应。对于 文档视类结构 来说, View 类始终是覆盖在 框架类 CMainFrame 之上的,任何操作都是 对 View 类窗口的操作,包括鼠标移动、鼠标左键点击,这些消息都是只能由View 类去捕获。这就是为什么在框架类中我们接受不到鼠标左键的点击的这一消息。在 CDrawView 头文件( .h 文件)中: /AFX_MSG(CDrawView)afx_msg void OnLButtonDown(UINT nFlags, CPoint point);/AFX_MSGDECLARE_MESSAGE_MAP()其中 /A

24、FX_MSG(CDrawView)/AFX_MSG 为两个 注释宏 ,afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 为函数声明 ,是消息响应的函数 声明; afx_msg 也是一个宏。在 CDrawView 源文件( .cpp 文件)中:BEGIN_MESSAGE_MAP(CDrawView, CView) /AFX_MSG_MAP(CDrawView) ON_WM_LBUTTONDOWN()/AFX_MSG_MAP/ Standard printing commandsON_COMMAND(ID_FILE_PRINT, CVie

25、w:OnFilePrint)ON_COMMAND(ID_FILE_PRINT_DIRECT, CView:OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView:OnFilePrintPreview)END_MESSAGE_MAP()其中 WM_LBUTTONDOWN() 是一个消息,而 ON_WM_LBUTTONDOWN() 是一个宏, 这个宏就将 WM_LBUTTONDOWN() 这个鼠标左键按下去的消息和一个消息响应函数 OnLButtonDown () 消息关联起来。通过这样的一个宏,就将消息和消息响应函数关联起 来了。这样的话,一旦有

26、消息产生,就回去调用消息响应函数去处理。当我们去增加一个消息响应函数时, 在三个地方都修改了代码头文件中在两个注释宏之 间增加了 afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 这一 函数声明, 在源 文件中加入了一个消息响应的宏, 通过这个宏, 将消息和消息响应函数关联起来了, 最终有 一个 void CMainFrame: OnLButtonDown (UINT nFlags, CPoint point) 消息实现的部分。消息映射 消息处理的一种机制,实现方法:第一种: 在基类当中针对每一种消息做一个虚函数, 当子类对该消息进行

27、响应时, 我们只需 重写虚函数即可。第二种: MFC 在后台维护了一个句柄和 C+ 类对象指针的映射表,一旦有消息发生,便可 以知道该消息和哪一个窗口相关的, 通过该句柄找到相对应的 C+ 对象的指针, 然后将这个 指针传给基类,基类同样的通过消息循环,最终调用 WindowProc 这个函数来对消息进行 处理( WindowProc 是一个虚函数) ,而 WindowProc 又调用的是 OnWndMsg ()函数 去处 理,之后 OnWndMsg ()函数 又会根据消息种类去判断、查找消息映射。而查找消息映射 是根据头文件中的消息响应函数原型的声明、 源文件中的消息映射, 最终找打了消息响

28、应函 数,由消息响应函数对消息进行响应。CPoint 表示点的一个类, private:CPoint m_ptOrigin;m_hWnd :获取 View 类窗口的句柄, 从 CWnd 类中派生出来的类中都有一个数据成员保存 了跟 C+ 类相关的一个窗口的句柄,因此在 CDrawView 中也有一个成员变量保存了 CDrawView 类相关的一个窗口句柄,即 m_hWnd 。CDC :所有与作图的操作都放到这个类中。 CDC 定义了一个 设备上下文 ( device context) 的类,CDC对象提供 了成员函数(member functions)用于和一个 设备一上下文一起工作, 比如显

29、示和打印。 CDC 提供了很多成员函数, 其中一个数据成员 m_hDC 保存了和 CDC 类 关的一个 DEC 句柄。释放DC使用CWnd窗口类内部的成员函数 ReleaseDC(),参数为一指针。CDC 类定义的是设备上下文对象的类。CDC 对象提供处理显示器或打印机等设备上下文的成员函数,以及处理与窗口客户区对应 的显示上下文的成员。通过 CDC 对象的成员函数进行所有的绘图。类对设备上下文操作提供了成员函数,处理绘图工具。安全型图形设备接口(GDI)对象收集,以及处理颜色和调色板。它还为获取和设置绘图属性、映射,处理视点、窗口扩展、转换坐标,处理区域、剪贴、绘 制直线及绘制简单椭圆和多边

30、形等形状提供了成员函数。另外还为绘制文本、处理字体,使用打印机跳转,滚动和播放元文件提供成员函数。使用 CDC 对象时要构造它, 然后调用与它平等的、 使用设备上下文的 Windows 函数的成员函数。使用 CWnd 类完成绘图:作 图函 数 :先 用 MoveTo() 函数 将 一个 点移 动 到 原 点 m_ptOrigin 位 置 , MoveToEx(hdc,m_ptOrigin.x,m_ptOrigin.y,NULL);, 画 线 则 用 LineTo() 函 数 , 其 参 数 为 LineTo(hdc,point.x,point.y);所编辑代码为:void CDrawView:

31、OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultm_ptOrigin= point;CView:OnLButtonDown(nFlags, point);void CDrawView:OnLButtonUp(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultHDC hdc;hdc=:GetDC(m_hWnd);Mov

32、eToEx(hdc,m_ptOrigin.x,m_ptOrigin.y,NULL);/点函数LineTo(hdc,point.x,point.y); /画线函数:ReleaseDC(m_hWnd,hdc);CView:OnLButtonUp(nFlags, point);使用 CDC 类完成绘图:void CDraw2View:OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultm_ptOrigin=point;CView:OnLButtonD

33、own(nFlags, point);void CDraw2View:OnLButtonUp(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultCDC*pDC=GetDC();pDC-MoveTo(m_ptOrigin);pDC-LineTo(point);ReleaseDC(pDC);CView:OnLButtonUp(nFlags, point);使用 CCientDC 类完成绘图:构造时调用 GetDC,析构时调用ReleaseDC。但并不需要显式的去调用,而只需

34、要去构造CCientDC 的对象即可,当对象的生命周期结束后自动地会将 DC 所占的资源释放掉。 构造函数 CClientDC(CWnd*pWnd).void CDraw3View:OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultm_ptOrigin= point;CView:OnLButtonDown(nFlags, point);void CDraw3View:OnLButtonUp(UINT nFlags, CPoint point)

35、/ TODO: Add your message handler code here and/or call defaultCClientDC dc(this);/ CClientDC dc(GetParent();dc.MoveTo(m_ptOrigin);dc.LineTo(point);CView:OnLButtonUp(nFlags, point);使用 CWindowDC 类完成绘图:CWindowDC 也是从 CDC 派生出来的, 在构造时 调用 GetWindowDC(), 析构时调用 ReleaseDC() 。 同样在构造 CWindowDC 也不需要显式地去调用 GetWin

36、dowDC() 和 ReleaseDC(),在构造和析构时分别完成了 DC句柄的获取和 DC的释放。而CWindowDC对 象可以访问整个屏幕区域,包括客户区和非客服区。CWindowDC( CWnd* pWnd );void CDraw4View:OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call default m_ptOrigin=point;CView:OnLButtonDown(nFlags, point);void CDraw4View:OnLB

37、uttonUp(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call default/CWindowDC dc(this);CWindowDC dc(GetParent();dc.MoveTo(m_ptOrigin);dc.LineTo(point);CView:OnLButtonUp(nFlags, point);使用 CWnd:GetDesktopWindow完成绘图:static CWnd* PASCAL GetDesktopWindow( );利用 GetDesktopWindo

38、w( ) 来获取 windows 桌面窗口。void CDraw4View:OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call default m_ptOrigin=point;CView:OnLButtonDown(nFlags, point);void CDraw4View:OnLButtonUp(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or cal

39、l default/CWindowDC dc(this);CWindowDC dc(GetDesktopWindow () );dc.MoveTo(m_ptOrigin);dc.LineTo(point);CView:OnLButtonUp(nFlags, point);CPen:圭寸装了跟画笔相关的操作Constructs a CPen object.。构造函数 CPen( );CPen( int nPenStyle, int nWidth, COLORREF crColor );throw( CResourceException );CPen( int nPenStyle, int nWi

40、dth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle= NULL );throw( CResourceException );ParametersnPenStyle画笔类型:Specifies the pen style. This parameter in the first version of the constructor can be one of the following values:PS_SOLID Creates a solid pen.PS_DASH Creates a dash

41、ed pen. Valid only when the pen width is 1 or less, in device units. PS_DOT Creates a dotted pen. Valid only when the pen width is 1 or less, in device units. PS_DASHDOT Creates a pen with alternating dashes and dots. Valid only when the pen width is 1 or less, in device units.PS_DASHDOTDOT Creates

42、a pen with alternating dashes and double dots. Valid only when the pen width is 1 or less, in device units.PS_NULL Creates a null pen.PS_INSIDEFRAME Creates a pen that draws a line inside the frame of closed shapes produced by the Windows GDI output functions that specify a bounding rectangle (for e

43、xample, the Ellipse, Rectangle, RoundRect, Pie, and Chord member functions). When this style is used with Windows GDI output functions that do not specify a bounding rectangle (for example, the LineTo member function), the drawing area of the pen is not limited by a frame.The second version of the C

44、Pen constructor specifies a combination of type, style, end cap, andjoin attributes. The values from each category should be combined by using the bitwise OR operator (|). The pen type can be one of the follow ing values:PS_GEOMETRIC Creates a geometric pen.PS_COSMETIC Creates a cosmetic pen.The sec

45、ond version of the CPen constructor adds the following pen styles for nPenStyle: PS_ALTERNATE Creates a pen that sets every other pixel. (This style is applicable only for cosmetic pen s.)PS_USERSTYLE Creates a pen that uses a styli ng array supplied by the user.The end cap can be one of the follow

46、ing values:PS_ENDCAP_ROUND End caps are round.PS_ENDCAP_SQUARE End caps are square.PS_ENDCAP_FLAT End caps are flat.The join can be one of the follow ing values:PS_JOIN_BEVELJoi ns are beveled.PS_JOIN_MITERJoi ns are mitered whe n they are within the curre nt limit set bythe :SetMiterLimit function.

47、 If the join exceeds this limit, it is beveled.PS_JOIN_ROUND Joi ns are round.nWidth画笔宽度:Specifies the width of the pen.For the first vers ion of the con structor, if this value is 0, the width in device un its is always 1 pixel, regardless of the mapp ing mode.For the sec ond version of the con str

48、uctor, if nPen Style is PS_GEOMETRIC, the width is give n in logical units. If nPenStyle is PS_COSMETIC, the width must be set to 1.crColor画笔颜色:Contains an RGB color for the pen.宏 RGB : The RGB macro selects a red, green, blue (RGB) color based on the arguments supplied and the color capabilities of

49、 the output device.COLORREF RGB(BYTE byRec|BYTE byGreen,BYTE byBlue/ red comp onent of color/ gree n comp onent of color/ blue comp onent of color);RemarksThe intensity for each argument is in the range 0 through 255. If all three intensities are zero, the result is black. If all three intensities a

50、re 255, the result is white.To extract the in dividual values for the red, gree n, and blue comp onents of a COLORREfolor value, use the GetRValue, GetGValue, and GetBValue macros, respectively.When creating or examining a logical palette, use the RGBQUADructure to define color values and exam ine i

51、n dividual comp onent values. For more in formatio n about using color values in a color palette, see the descriptio ns of the PALETTEINDE% nd PALETTERGmacros.SelectObject:当创建完画笔后并不会生效,需要将画笔选到设备描述表当中,这样通过设 备描述表去作图时,画笔的颜色才会由新的画笔颜色决定。将画笔选择到设备描述表中需要函数 SelectObject。CDC:SelectObjectCPe n* SelectObject( C

52、Pe n*pPe n);Retur n Value(返回值)A poin ter to the object being replaced. This is a poin ter to an object of one ofthe classes derived from CGdiObject, such as CPen, depe nding on which vers ion of the function is used. The return value is NULL if there is an error. This function mayreturn a pointer to

53、 a temporary object. This temporary object is only valid during theprocess ingof one Win dows message. For morein formati on,seeCGdiObject:FromHa ndle.代码如下:void CDrawView:OnLButtonDown(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call default m_ptOrigin=point;CView:OnL

54、ButtonDown(nFlags, point);void CDrawView:OnLButtonUp(UINT nFlags, CPoint point)/ TODO: Add your message handler code here and/or call defaultCPen pen(PS_SOLID,2,RGB(24O,1OO,5O); /PS 表示 Pen StyleCClientDC dc(this/*GetParent()*/);CPen*pOldPen=dc.SelectObject(&pen);/ 选择当前画笔颜色dc.MoveTo(m_ptOrigin);dc.Li

55、neTo(point);dc.SelectObject(pOldPen); / 选择原有画笔颜色CView:O nLButto nU p( nFlags, poi nt);CBrush:创建画刷,构造函数:CBrush( COLORREF crColor );构造函数:CBrush( CBitmap*pBitmap );/创建位图画刷CBitmap( )构造函数 CBitmap( );说明: Constructs a CBitmap object. The resulting object must be initialized (初始化)withone of the initializati

56、on member functions (初始化的成员函数).初始化成员函数 Ini tializationLoadBitmapInitializesthe object by loading a named bitmapresource from the application s executable file andattach ing the bitmap to the object.LoadOEMBitmapInitializesthe object by loading a predefinedWindowsbitmap and attach ing the bitmap to the object.LoadMappedBitmapLoads a bitmap and maps colors to current system colors.CreateBitmapIn itializes the object with a device-depe ndent memory bitmap that has a specified width, height, and bit pattern.CreateBitmapI ndirectIn itializes the object with a bitmap with th

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论