欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實現(xiàn)帶引導窗體的窗體設計操作流程

 更新時間:2024年04月24日 09:12:55   作者:wenchm  
很多時候,我們的窗體設計需要一個引導窗體,當打開一個項目的窗體時,默認的是先打開一個歡迎或介紹項目信息的引導窗體,幾秒鐘后再打開項目的主窗體,本文給大家介紹了C#實現(xiàn)帶引導窗體的窗體設計操作流程,感興趣的朋友可以參考下

引言

很多時候。我們的窗體設計需要一個引導窗體。當打開一個項目的窗體時,默認的是先打開一個歡迎或介紹項目信息的引導窗體,幾秒鐘后再打開項目的主窗體。這幾秒時間最重要的意義是等待主窗體加載程序完畢。

1.設計操作流程

實現(xiàn)帶引導窗體的窗體設計操作流程:在項目里先設計兩個窗體,并把Form1改名為Frm_Main,把Form2改名為Frm_Start。切記在更改窗體名稱的時候按下ENTER確認此更改影響到了整個工程。

接著,把項目所需要的圖片資源設計到圖片資源管理器,并把圖片設計為相應窗體的背景,stretch。這一步的操作,詳見本文作者寫的其他文章。

進一步地,在Frm_Main窗體創(chuàng)建Load事件,在事件里定義Frm_Start的對象,并打開Frm_Start窗體。

進一步地,在Frm_Start窗體創(chuàng)建Load事件、設計Timer組件,并設計一個Tick事件,再創(chuàng)建一個FormClosed事件;在其Load事件中啟動定時器,設置定時器動作時間為10s,在定時器的Tick事件中設計為關閉窗體引導窗體;在其FormClosed事件設計為關閉定時器;

好了,至此符合項目需要的操作流程設計完畢,下面上代碼。

2.實例

(1)Resources.Designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     此代碼由工具生成。
//     運行時版本:4.0.30319.42000
//
//     對此文件的更改可能會導致不正確的行為,并且如果
//     重新生成代碼,這些更改將會丟失。
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace _193.Properties {
    using System;
    
    
    /// <summary>
    ///   一個強類型的資源類,用于查找本地化的字符串等。
    /// </summary>
    // 此類是由 StronglyTypedResourceBuilder
    // 類通過類似于 ResGen 或 Visual Studio 的工具自動生成的。
    // 若要添加或移除成員,請編輯 .ResX 文件,然后重新運行 ResGen
    // (以 /str 作為命令選項),或重新生成 VS 項目。
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        
        /// <summary>
        ///   返回此類使用的緩存的 ResourceManager 實例。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_193.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   重寫當前線程的 CurrentUICulture 屬性,對
        ///   使用此強類型資源類的所有資源查找執(zhí)行重寫。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 類型的本地化資源。
        /// </summary>
        internal static System.Drawing.Bitmap C_編程詞典 {
            get {
                object obj = ResourceManager.GetObject("C_編程詞典", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 類型的本地化資源。
        /// </summary>
        internal static System.Drawing.Bitmap start {
            get {
                object obj = ResourceManager.GetObject("start", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
    }
}

(2)Frm_Main.Designer.cs

namespace _193
{
    partial class Frm_Main
    {
        /// <summary>
        ///  Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        ///  Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        ///  Required method for Designer support - do not modify
        ///  the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            SuspendLayout();
            // 
            // Frm_Main
            // 
            AutoScaleDimensions = new SizeF(7F, 17F);
            AutoScaleMode = AutoScaleMode.Font;
            BackgroundImage = Properties.Resources.C_編程詞典;
            BackgroundImageLayout = ImageLayout.Stretch;
            ClientSize = new Size(367, 238);
            Name = "Frm_Main";
            Text = "軟件主界面";
            Load += Frm_Main_Load;
            ResumeLayout(false);
        }
 
        #endregion
    }
}

(3)Frm_Main.cs

namespace _193
{
    public partial class Frm_Main : Form
    {
        public Frm_Main()
        {
            InitializeComponent();
        }
 
        private void Frm_Main_Load(object sender, EventArgs e)
        {
            Frm_Start frm = new();
            frm.ShowDialog();
        }
    }
}

(4)Frm_Start.Designer.cs

namespace _193
{
    partial class Frm_Start
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();
            timer1 = new System.Windows.Forms.Timer(components);
            SuspendLayout();
            // 
            // timer1
            // 
            timer1.Tick += Timer1_Tick;
            // 
            // Frm_Start
            // 
            AutoScaleDimensions = new SizeF(7F, 17F);
            AutoScaleMode = AutoScaleMode.Font;
            BackgroundImage = Properties.Resources.start;
            BackgroundImageLayout = ImageLayout.Stretch;
            ClientSize = new Size(368, 240);
            Name = "Frm_Start";
            Text = "啟動界面";
            FormClosed += Frm_Start_FormClosed;
            Load += Frm_Start_Load;
            ResumeLayout(false);
        }
 
        #endregion
 
        private System.Windows.Forms.Timer timer1;
    }
}

(5)Frm_Start.cs

namespace _193
{
    public partial class Frm_Start : Form
    {
        public Frm_Start()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 啟動計時器,10s計時
        /// </summary>
        private void Frm_Start_Load(object sender, EventArgs e)
        {
            timer1.Start();
            timer1.Interval = 10000;
        }
        /// <summary>
        /// 關閉啟動窗體
        /// </summary>
        private void Timer1_Tick(object sender, EventArgs e)
        {
            Close();
        }
        /// <summary>
        /// 關閉計時器
        /// </summary>
        private void Frm_Start_FormClosed(object sender, FormClosedEventArgs e)
        {
            timer1.Stop();
        }
    }
}

(6)生成效果

到此這篇關于C#實現(xiàn)帶引導窗體的窗體設計操作流程的文章就介紹到這了,更多相關C#引導窗體設計內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • C# 多進程打開PPT的示例教程

    C# 多進程打開PPT的示例教程

    這篇文章主要介紹了C# 多進程打開PPT的示例教程,幫助大家更好的理解和使用c#,感興趣的朋友可以了解下
    2021-01-01
  • 在C#中使用二叉樹實時計算海量用戶積分排名的實現(xiàn)詳解

    在C#中使用二叉樹實時計算海量用戶積分排名的實現(xiàn)詳解

    這篇文章主要介紹了在C#中使用二叉樹實時計算海量用戶積分排名的實現(xiàn)詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-01-01
  • c#自定義泛型類的實現(xiàn)

    c#自定義泛型類的實現(xiàn)

    本篇文章是對c#中自定義泛型類的實現(xiàn)方法進行了詳細的分析介紹,需要的朋友參考下
    2013-05-05
  • C#獲取文件MD5值的實現(xiàn)示例

    C#獲取文件MD5值的實現(xiàn)示例

    文件的md5值,即文件簽名,為了驗證文件的正確性,是否被惡意篡改等。每個文件有一個唯一的md5。下面這篇文中就給大家介紹了如何利用C#獲取文件MD5值,有需要的朋友們可以參考借鑒,下面來一起看看吧。
    2016-12-12
  • C# yield關鍵字詳解

    C# yield關鍵字詳解

    這篇文章主要介紹了C# yield關鍵字詳解,本文講解了yield是一個語法糖、語法糖的實現(xiàn)(實現(xiàn)IEnumerable<T>接口的類)、yield使用中的特殊情況等內(nèi)容,需要的朋友可以參考下
    2015-04-04
  • C#自動類型轉換與強制類型轉換的講解

    C#自動類型轉換與強制類型轉換的講解

    今天小編就為大家分享一篇關于C#自動類型轉換與強制類型轉換的講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2019-01-01
  • C# IEnumerator枚舉器的具體使用

    C# IEnumerator枚舉器的具體使用

    本文主要介紹了C# IEnumerator枚舉器的具體使用,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2022-06-06
  • C#實現(xiàn)過濾html標簽并保留a標簽的方法

    C#實現(xiàn)過濾html標簽并保留a標簽的方法

    這篇文章主要介紹了C#實現(xiàn)過濾html標簽并保留a標簽的方法,文中的自定義函數(shù)采用正則過濾實現(xiàn)了該功能,是非常實用的技巧,需要的朋友可以參考下
    2014-09-09
  • C#提高編程能力的50個要點總結

    C#提高編程能力的50個要點總結

    這篇文章主要介紹了C#提高編程能力的50個要點,較為詳細的總結分析了C#程序設計中常見的注意事項與編程技巧,需要的朋友可以參考下
    2016-02-02
  • 比較2個datatable內(nèi)容是否相同的方法

    比較2個datatable內(nèi)容是否相同的方法

    這篇文章主要介紹了比較2個datatable內(nèi)容是否相同的方法,大家參考使用吧
    2014-01-01

最新評論