程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> 如何制作winform得啟動畫面

如何制作winform得啟動畫面

編輯:.NET實例教程

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace SlashScreenLib
{
    public class SlashScreenForm:Form
    {
        static SlashScreenForm slashScreen;
        Bitmap bitMap;
        public static SlashScreenForm SlashScreen
        {
            get
            {
                if (slashScreen == null)
                {
                    slashScreen = new SlashScreenForm();
                }
                return slashScreen;
            }
        }
 
        public SlashScreenForm()
        {
            //SlashScreen肯定顯示在屏幕中央
            this.StartPosition = FormStartPosition.CenterScreen;
            //應該沒有邊框
            this.FormBorderStyle = FormBorderStyle.None;
            //獲取SlashScreen要顯示的圖片
            bitMap = Resources.Resource.SlashScreen;
            //窗口大小與圖片大小一致
            this.ClIEntSize = bitMap.Size;
            //在圖片上寫上字
            using (Font f = new Font("宋體", 18))
            {
                using (Graphics g = Graphics.FromImage(bitMap))
                {
                    g.DrawString("Jillzhang", f, Brushes.Black, 100, 142);
                }
            }
            this.BackgroundImage = bitMap;
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                if (bitMap != null)
                {
                    bitMap.Dispose();
                    bitMap = null;
                }
            }
        }
    }
}

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved