最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#實(shí)現(xiàn)帶引導(dǎo)窗體的窗體設(shè)計(jì)操作流程

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

引言

很多時候。我們的窗體設(shè)計(jì)需要一個引導(dǎo)窗體。當(dāng)打開一個項(xiàng)目的窗體時,默認(rèn)的是先打開一個歡迎或介紹項(xiàng)目信息的引導(dǎo)窗體,幾秒鐘后再打開項(xiàng)目的主窗體。這幾秒時間最重要的意義是等待主窗體加載程序完畢。

1.設(shè)計(jì)操作流程

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

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

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

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

好了,至此符合項(xiàng)目需要的操作流程設(shè)計(jì)完畢,下面上代碼。

2.實(shí)例

(1)Resources.Designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     此代碼由工具生成。
//     運(yùn)行時版本:4.0.30319.42000
//
//     對此文件的更改可能會導(dǎo)致不正確的行為,并且如果
//     重新生成代碼,這些更改將會丟失。
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace _193.Properties {
    using System;
    
    
    /// <summary>
    ///   一個強(qiáng)類型的資源類,用于查找本地化的字符串等。
    /// </summary>
    // 此類是由 StronglyTypedResourceBuilder
    // 類通過類似于 ResGen 或 Visual Studio 的工具自動生成的。
    // 若要添加或移除成員,請編輯 .ResX 文件,然后重新運(yùn)行 ResGen
    // (以 /str 作為命令選項(xiàng)),或重新生成 VS 項(xiàng)目。
    [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 實(shí)例。
        /// </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>
        ///   重寫當(dāng)前線程的 CurrentUICulture 屬性,對
        ///   使用此強(qiáng)類型資源類的所有資源查找執(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>
        /// 啟動計(jì)時器,10s計(jì)時
        /// </summary>
        private void Frm_Start_Load(object sender, EventArgs e)
        {
            timer1.Start();
            timer1.Interval = 10000;
        }
        /// <summary>
        /// 關(guān)閉啟動窗體
        /// </summary>
        private void Timer1_Tick(object sender, EventArgs e)
        {
            Close();
        }
        /// <summary>
        /// 關(guān)閉計(jì)時器
        /// </summary>
        private void Frm_Start_FormClosed(object sender, FormClosedEventArgs e)
        {
            timer1.Stop();
        }
    }
}

(6)生成效果

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

相關(guān)文章

最新評論

思茅市| 诏安县| 恩平市| 区。| 贡山| 东阿县| 澄迈县| 阿拉善右旗| 且末县| 宁都县| 郎溪县| 汕尾市| 靖州| 紫云| 怀仁县| 乌拉特后旗| 双鸭山市| 泗洪县| 沅陵县| 武宁县| 铜鼓县| 台安县| 友谊县| 沁源县| 柞水县| 宁陵县| 正镶白旗| 哈尔滨市| 汉阴县| 山西省| 台江县| 阳城县| 宣城市| 韶山市| 侯马市| 理塘县| 昆山市| 万山特区| 武清区| 驻马店市| 桦甸市|