《计算机语言编程教程常用控件》由会员分享,可在线阅读,更多相关《计算机语言编程教程常用控件(17页珍藏版)》请在金锄头文库上搜索。
1、第三讲:常用控件常用控件应用应用 程序框架程序框架 杨章伟 e-mail:Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only.
2、Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.课程内容安排 控件的基本概念 Visual C+Visual C+中的控件中的控件 控件的应用综合练习控件的应用综合练习 控件应用实例控件应用实例 综合练习综合练习 思考和习题思考和习题 Evaluatio
3、n only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client
4、 Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.控件的基本概念 控件是独立的小部件,在对话框与用户的交互 过程中,担任着主要角色。对话框在Visual C+中实际上是窗口,因此,控件可以说是构 成应用程序窗体的主要组成部分。 Evaluation only.Evaluation only. Created with Aspose.Slides
5、for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NE
6、T 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Visual C+中的控件 Visual C+ 6.0中所有的控件类都是由 CWnd类派生来的,因此,控件实际上也 是窗口。控件通常是作为对话框的子窗口 而创建的,控件也可以出现在视图窗口、 工具栏和状态栏中。控件的种类很多, Visual C+ 6.0提供的一些基本控件如 图3-3所示。Evaluation only.Evaluation only. Created with Aspose.Sl
7、ides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides fo
8、r .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.文本控件 文本控件是指在在对话框中显示文字或图像的控 件,该类控件是一种单向交互的控件,只能支持 应用程序的输出,而不能接受用户的输入。在 Visual C+中其包含静态正文控件(Static Text)和图片控件(Picture)两种。 Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Cl
9、ient Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Pr
10、ofile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.图片控件Picture n图片控件的使用与静态正文对话框相似, 将Picture控件拖动到对话框中,并单击右 键打开如图3-9所示属性对话框,为其设置 属性即可 。Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3
11、.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyrigh
12、t 2004-2011 Aspose Pty Ltd.编辑框控件(Edit Box) 编辑框控件可以接受用户的输入和编辑。在编 辑框中,用户可以输入文字、数字,并能用剪 切、粘贴、复制、删除等操作来编辑用户的输 入,编辑框既可以是单行的,也可以是多行的 。Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 20
13、04-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.按钮控件 命令按钮()的
14、作用是对用户的鼠标单击 作出反应并触发相应的事件,在按钮中既 可以显示正文,也可以显示位图。按钮可 以响应鼠标单击的小矩形子窗口,向父窗 口发出两种控件通知消息:BN_CLICKED (在按钮上单击)和 BN_DOUBLECLICKED(在按钮上双击 ) 。Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2
15、004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.列表框控件(List
16、Box) 列表框控件是一个条目列表,它允许用户 从所列出的表项中进行单项或多项选择, 被选择的项呈高亮度显示。列表框具有边 框,并且一般带有一个垂直滚动条。列表 框分单选列表框和多重选择列表框两种: 单选列表框一次只能选择一个列表项,而 多重选择列表框可以进行多重选择。 Evaluation only.Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.Evaluation only.Evaluation only. Created with Aspo