- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
案例:可扩展的对话框培训教程文件
案例2:可扩展的对话框 需求与目标 这个功能类似QQ的显示聊天记录 当用户要显示一些过多的选择时,对话框自动扩展其大小,将隐藏的部分显示出来 效果 效果 手段 利用CDialog类的SetRect函数来设定对话框的大小 手段 利用CDialog类的SetRect函数来设定对话框的大小 调用MoveWindow函数来实现改变对话框的大小 编程步骤(1) 使用AppWizard创建一个基于对话框的应用程序 编程步骤(2) 为对话框添加一些控件 编程步骤(2) 编程步骤(2) 编程步骤(3) 为对话框添加3个成员变量: BOOL m_bExpand; // 记录是否已经扩展对话框 UINT m_nExpandedHeight; // 扩展后对话框的高度 UINT m_nNormalHeight; // 扩展前对话框的高度 BOOL typedef int BOOL; typedef long BOOL; A Boolean value. UINT??? typedef unsigned int UINT; A 16-bit unsigned integer on Windows versions 3.0 and 3.1; a 32-bit unsigned integer on Win32. 编程步骤(4) 在对话框的OnInitDialog函数中加入以下代码: m_bExpand = FALSE; CRect rcDlg, rcMarker; GetWindowRect(rcDlg); m_nExpandedHeight = rcDlg.Height(); GetDlgItem(IDC_BORDER)-GetWindowRect(rcMarker); m_nNormalHeight = (rcMarker.top - rcDlg.top); rcDlg.SetRect(rcDlg.left, rcDlg.top, rcDlg.left + rcDlg.Width(), rcDlg.top + m_nNormalHeight); MoveWindow(rcDlg, TRUE); CWnd::GetWindowRect void GetWindowRect( LPRECT lpRect ) const; lpRect Points to a CRect object or a RECT structure that will receive the screen coordinates of the upper-left and lower-right corners. Remarks Copies the dimensions of the bounding rectangle of the CWnd object to the structure pointed to by lpRect. The dimensions are given in screen coordinates relative to the upper-left corner of the display screen. The dimensions of the caption, border, and scroll bars, if present, are included. RECT、 LPRECT typedef struct tagRECT { LONG left; LONG top; LONG right; LONG bottom; } RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT; CRect class CRect : public tagRECT { public: …… // retrieves the width int Width() const; // returns the height int Height() const; …… } CWnd::GetDlgItem? CWnd* GetDlgItem( int nID ) const; nID Specifies the identifier of the control or child window to be retrieved. Return Value A pointer to the given control or child window. If no control with the integer ID given by the nID parameter exists, the value is NULL. Th
您可能关注的文档
最近下载
- 商业秘密保护知识培训.ppt VIP
- 生态学全套配套课件第三版杨持第二章.ppt VIP
- 《向上管理 与你的领导相互成就》读书笔记思维导图.pptx VIP
- 钢结构工程维修施工方案.docx VIP
- 2023年武汉科技大学计算机科学与技术专业《计算机网络》科目期末试卷A(有答案).docx VIP
- 电信春节通信保障应急预案.docx VIP
- 女装设计 全套课件(上).pptx VIP
- 珠海市政府投资项目建设监督管理中心招考合同制职员考前自测高频考点模拟试题(共500题)含答案详解.docx VIP
- 体例格式9:工学一体化课程《小型网络安装与调试》任务4学习任务工作页.docx VIP
- 建筑节能工程监理质量评估报告.pdf VIP
文档评论(0)