现在的位置: 首页 > 综合 > 正文

C#启动画面制作

2012年10月02日 ⁄ 综合 ⁄ 共 1264字 ⁄ 字号 评论关闭
新建C# Windows应用程序。
把图标文件ABC.ico和背景图片hy.bmp复制到目录下,
属性->复制到输出目录->始终复制
右击项目->属性->应用程序->图标和清单->图标,修改为ABC.ico
背景图片大小352*302把窗体的size属性也修改为352*302
窗体代码如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Diagnostics;
using Microsoft.Win32;

namespace StartSetup
{
    
public partial class FrmStart : Form
    {
        
int iCount = 0;
        
public FrmStart()
        {
            InitializeComponent();
            
//启动画面
            this.FormBorderStyle = FormBorderStyle.None;//去掉外框
            this.BackgroundImage = Image.FromFile("hy.bmp");//背景图片
            this.StartPosition = FormStartPosition.CenterScreen;//屏幕中央
        }

        private void FrmStart_Load(object sender, EventArgs e)
        {
            
//启动定时器
            timer1.Start();
            timer1.Interval 
= 100;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            
if (iCount > 700)
            {
                Application.Exit();
//启动动画完了之后..
                return;
            }
            iCount 
+= 10;
            
this.Opacity = 1 - Convert.ToDouble(iCount) / 1000;//窗体透明度减小
        }
    }
}

源码:http://files.cnblogs.com/greatverve/StartSetup.rar

抱歉!评论已关闭.