splashform.cs

来自「Microsoft Mobile Development Handbook的代码」· CS 代码 · 共 35 行

CS
35
字号
using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

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

        private void SplashForm_Load(object sender, EventArgs e)
        {
            // Show full screen
            this.ControlBox = false;

            // Load graphic into PictureBox
            string path = GetApplicationDirectory();
            Image img = new Bitmap(Path.Combine(path, "graphic.jpg"));
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox1.Image = img;
        }

        private string GetApplicationDirectory()
        {
            return System.IO.Path.GetDirectoryName(
                System.Reflection.Assembly.GetExecutingAssembly()
                .GetModules()[0].FullyQualifiedName);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?