当前位置:编程学习 > C#/ASP.NET >>

我有个C#的问题,启动界面的制作是程序中有个问题。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Windows.Forms; 

namespace qidongjiemian1 

    static class Program 
    { 
        public class FlashScreen : System.Windows.Forms.Form 
        { 
            private System.Windows.Forms.Timer timer; 
            private System.ComponentModel.IContainer components; 
            private System.Windows.Forms.LinkLabel linkLabl1; 
            private int count; 
            private bool autoClose; 
            public FlashScreen(bool ac) 
            { 
                InitializeComponent(); 
                autoClose = ac; 
            } 
            protected override void Dispose(bool disposing) 
            { 
                if (disposing) 
                { 
                    if (components != null) 
                    { 
                        components.Dispose(); 
                    } 
                } 
                base.Dispose(disposing); 
            } 
            #region Windows Form Designer generated code 
            private void InitializeComponent() 
            { 
                this.components = new System.ComponentModel.Container(); 
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FlashScreen)); 
                this.timer = new System.Windows.Forms.Timer(this.components); 
                this.linkLabl1 = new System.Windows.Forms.LinkLabel(); 
                this.SuspendLayout(); 
                this.timer.Tick += new System.EventHandler(this.timer_Tick); 
                this.linkLabl1.BackColor = System.Drawing.Color.Transparent; 
                this.linkLabl1.Location = new System.Drawing.Point(0, 256); 
                this.linkLabl1.Name = "linLabl1"; 
                this.linkLabl1.Size = new System.Drawing.Size(104, 16); 
                this.linkLabl1.TabIndex = 0; 
                this.linkLabl1.Text = "ELWG-ITEG-UHST"; 
                this.linkLabl1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 
                this.linkLabl1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabl1_LinkClicked); 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6, 14); 
                this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage"))); 
                this.ClientSize = new System.Drawing.Size(401, 301); 
                this.Controls.AddRange(new System.Windows.Forms.Control[] { this.linkLabl1 }); 
                this.Cursor = System.Windows.Forms.Cursors.AppStarting; 
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 
                this.Name = "FlashScreen"; 
                this.Opacity = 0; 
                this.ShowInTaskbar = false; 
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 
                this.Text = "FlashScreen"; 
                this.TopMost = true; 
                this.Click += new System.EventHandler(this.FlashScreen_Click); 
                this.Load += new System.EventHandler(this.FlashScreen_Load); 
            } 
            #endregion 
            private void FlashScreen_Load(object sender, System.EventArgs e) 
            { 
                timer.Enabled = true; 
                count = 0; 
            } 
            private void timer_Tick(object sender, System.EventArgs e) 
            { 
                if (count++ > 45 && autoClose == true) 
                    this.Close(); 
                this.Opacity += 0.05; 
            } 
            private void gogogo() 
            { 
                this.ShowDialog(); 
            } 
            public static void Begin(bool autoClose) 
            { 
                FlashScreen fs = new FlashScreen(autoClose); 
                System.Threading.Thread fsThead = new System.Threading.Thread(new System.Threading.ThreadStart(fs.gogogo)); 
                fsThead.Start(); 
                System.Threading.Thread.Sleep(2000); 
            } 
            private void linkLabl1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) 
            { 
                System.Diagnostics.Process.Start("iexplore", "http://www.baidu.com/"); 
            } 
            private void FlashScreen_Click(object sender, System.EventArgs e) 
            { 
                this.Close(); 
            } 

        }         
        ///  <summary> 
        /// 应用程序的主入口点。 
        ///  </summary> 
        [STAThread] 
        static void Main() 
        { 
            Application.EnableVisualStyles(); 
            Application.SetCompatibleTextRenderingDefault(false); 
            FlashScreen.Begin(true); 
            Application.Run(new Form1()); 
        } 
    } 

程序如上,但是其中的一句话总是出错this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage"))); 这句总是提示出错,我用的是VC2008,并且 this.AutoScaleDimensions = new System.Drawing.SizeF(6, 14);与 
 this.AutoScaleBaseSize   =   new   System.Drawing.Size(6,   14);   是否相同呢??但是在VC2008中没有this.AutoScaleBaseSize  这个方法,谢谢专家给与解答。 

--------------------编程问答--------------------
引用楼主 iq9400 的帖子:
        ...
        static void Main()  
        {  
            Application.EnableVisualStyles();  
            Application.SetCompatibleTextRenderingDefault(false);  
            FlashScreen.Begin(true);                                      //<----
            Application.Run(new Form1());  
        }  


这样可以吗?我怎么感觉消息循环直到Application.Run()才建立起来? --------------------编程问答-------------------- 大哥,您能帮我看看么??谢谢了阿 哈哈
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,