第六章《Windows标准控件》.ppt

  1. 1、本文档共36页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
德州学院 计算机系 德州学院计算机系 Visual C++ 与面向对象程序设计 第6章 Windows标准控件 德州学院 计算机系 主讲教师 韩金姝 本章主要内容 控件概述 按钮控件 滚动条控件 静态控件(自学) 列表框子窗口控件 编辑框控件 控件概述 控件是Windows图形用户界面的主要组成部分之一。属于一般窗口,具有通用的窗口性质,且可使用ShowWindow和MoveWindow等窗口管理函数对其操作 创建控件的两种方式: 在对话框中制定控件。 调用CreateWindow/CreateWindowEx创建窗口类控件,和主窗口类似,填写WNDCLASS结构并注册。或使用Windows系统预定义的窗口类 控件概述 窗口间消息传递 作为子窗口的控件通过向其父窗口发送WM_COMMAN消息进行通信,wParam参数包含了子窗口的标志,低位是子窗口句柄,高位是通知代码(各种类型的操作表6-2) 应用程序调用,向特定子窗口发送消息 LRESULT SendMessage( HWND hWnd,UINT Msg, WPARAM wParam, LPARAM lParam); 对话框控件:SendDlgItemMessage( ) 控件概述 SendMessage An application sends a BM_SETSTYLE message to change the style of a button. lResult?=?SendMessage( ????//?returns?LRESULT?in?lResult ??? (HWND) hWndControl, ????// handle to destination control ???(UINT) BM_SETSTYLE,// message ID (WPARAM)?wParam, ????//?=?(WPARAM)?()?wParam;? ??(LPARAM)?lParam ????//?=?(LPARAM)?()?lParam; ); wParam :Specifies the new button style. This parameter can be a combination of button styles. For a table of button styles, see Button Styles. lParam :The low-order word of lParam specifies whether the button is to be redrawn. A value of TRUE redraws the button; a value of FALSE does not redraw the button. 控件概述 常用子窗口操作函数 应用程序对控件的操作,实质是子窗口操作的一种类型(P113) 获得指定窗口标题或文本:GetWindowText( )/GetDlgItemText( ) 设置窗口标题或文本:SetWindowText( )/SetDlgItemText( ) 激活或禁止窗口:EnableWindow( ) 关闭窗口:DestroyWindow( ) 控件概述 常用子窗口操作函数 5. 移动窗口或改变窗口大小:MoveWindow The MoveWindow function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent windows client area. bRepaint:[in] Specifies whether the window is to be repainted. If this parameter is TRUE, the window receives a message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (incl

您可能关注的文档

文档评论(0)

wxc6688 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档