温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

C#Windows应用程序开发添加状态条的方法

发布时间:2021-07-16 14:42:10 来源:亿速云 阅读:212 作者:chen 栏目:编程语言

这篇文章主要介绍“C#Windows应用程序开发添加状态条的方法”,在日常操作中,相信很多人在C#Windows应用程序开发添加状态条的方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”C#Windows应用程序开发添加状态条的方法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

C#Windows应用程序开发之添加状态条前言:通常windows应用程序都有相似的特征:控件、菜单、工具条、状态栏等等。每次我们开始作一个新的windows应用程序时都是以相同的事情开始:建立项目,添加控件和事件处理器。如果我们有一个模板,那么我们就可以节约大量的时间了。

在介绍如何建立模板的过程中,将涉及大量的微软.net framework类库的基本知识。如果你没有使用集成开发环境那么本文介绍的模板对你将非常有用,如果你使用了visual studio.net这样的集成开发环境你也可以从中了解控件的工作方式,这对你也是很有用的。

C#Windows应用程序开发之添加状态条的过程:

C#Windows应用程序开发之添加状态条由System.Windows.Forms.StatusBar描述,它提供了定制控件的外观的属性,状态条由StatusBarPanel对象组成,在我们的模板中状态条有两个嵌套板:

StatusBar statusBar = new StatusBar();   StatusBarPanel statusBarPanel1 = new StatusBarPanel();   StatusBarPanel statusBarPanel2 = new StatusBarPanel();

C#Windows应用程序开发之添加状态条之状态条和状态跳上的嵌套板由下面的代码设置:

statusBarPanel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;   statusBarPanel1.Text = "Press F1 for Help";   statusBarPanel1.AutoSize = StatusBarPanelAutoSize.Spring;   statusBarPanel2.BorderStyle = StatusBarPanelBorderStyle.Raised;   statusBarPanel2.ToolTipText = System.DateTime.Now.ToShortTimeString();   statusBarPanel2.Text = System.DateTime.Today.ToLongDateString();   statusBarPanel2.AutoSize = StatusBarPanelAutoSize.Contents;   statusBar.ShowPanels = true;   statusBar.Panels.Add(statusBarPanel1);   statusBar.Panels.Add(statusBarPanel2);

C#Windows应用程序开发之添加状态条目的:我们需要将状态条添加到窗体中:

this.Controls.Add(statusBar);

到此,关于“C#Windows应用程序开发添加状态条的方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI