使用Form创建欢迎界面

      大部分常见的商业软件中都存在着欢迎界面,如微软公司的Office系列产品、Visual Stdio 2010等。

欢迎界面中通常显示软件的基本信息和产品的商标标识,当应用程序启动时间较长时,还可以在显示欢迎界面的同时加载应用程序,从而使得用户从心里上增加对程序加载时间的容忍度。

      本例子的主要操作对象为窗体,即Form。其实使用的两个主要的窗体属性分别是StartPosition和FormBorderStyle。StartPosition属性用于控制窗体的起始位置,其中当设置为CenterScreen时即从屏幕的中央显示窗体。FormBorderStyle属性则用于控制窗体的外观。

 

namespace SplashScreen
{
    public partial class SplashScreen : Form
    {
        public SplashScreen()
        {
            InitializeComponent();
        }

        private void SplashScreen_Load(object sender, EventArgs e)
        {
           this.ClientSize = this.BackgroundImage.Size;//是欢迎界面的大小和背景图片的大小相同。
        }
    }
}

 

 

  #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // SplashScreen
            // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackgroundImage = global::SplashScreen.Properties.Resources.Tulips;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "SplashScreen";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "`";
            this.Load += new System.EventHandler(this.SplashScreen_Load);
            this.ResumeLayout(false);        }

        #endregion

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值