`
lovnet
  • 浏览: 6704898 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

c#.net实现splash screen(闪屏)的几个方法:

阅读更多

c#.net实现splash screen(闪屏)的几个方法:

闪屏直接用个form就可以了,然后在主form中new出来,并且调用form.show() (千万别用showdialog)。比较麻烦的是希望在这个时候把主窗体隐藏起来。下面是解决方法。

不能用常规的this.Visible来设定。因为form的load事件后form会show出来。

以下方法1~3测试有效:

1. On Form Load: Code: this.opacity = 0;

and then when you want to display it Code: this.opacity = 1; 设置opacity属性可以实现,然后让用一个timer来关闭闪屏和显示主屏。

2. - set the WindowState to Minimized on the Form properties - add the Form's Load event handler, in which you hide the form as follow: private void MainForm_Load(object sender, EventArgs e)

{ Hide(); } 设置 this.WindowState = FormWindowState.Minimized; 在Load事件里直接调用hide(); 之后再show出来,麻烦的是,需要用其他函数来激活form。因为它默认不在最上面。 另外要注意一点,直接在界面上设置state(或者在结构化的函数里设置,一样的..),不要在load事件里设置,否则无效。

3. You could do this.WindowState = WindowState.Minimized, which will minimize the form, but show it in the taskbar. By setting this.ShowInTaskbar to False, you'll get rid of the task, but it can still be gotten to via Alt-Tab. 这个思路不错。设置最小化,然后让菜单栏里面不出现这个form的选项,变相实现隐身。但是,缺点和上面的一样,需要用事件来激活,否则就藏在当前窗口的背后,我以前调用的api...麻烦死,不知道有没有好的方法。

4. The better way to do this would be to use a void Main() as a startup. Then, you can either just show the TrayIcon, or control what forms are shown. 说实话,这个方法的意思没搞清楚...

相关链接: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=155375&SiteID=1

http://forum.codecall.net/c-programming/1035-hide-form-startup.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics