winform小记

FormBorderStyle:None让边框消失

private int time = 5;//停止五秒 //计时器 private void timer1_Tick(object sender, EventArgs e) { if (time!=0) { time; } else { this.timer1.Stop(); UserThisFunction(); } } 让程序停止几秒,我是这样做的。如果用线程的sleep方法的话,UI会不出来

System.Environment.Exit(0); winform关闭程序

RegistryKey keyroot = Registry.ClassesRoot;
            string flashkey = @"CLSID\{D27CDB6E-AE6D-11cf-96B8-444553540000}";
            RegistryKey rkFlash = keyroot.OpenSubKey(flashkey);
            if (rkFlash == null)
            {
                //System.Diagnostics.Process.Start(Application.StartupPath + "\\flash10.exe");

                DialogResult dialog = MessageBox.Show("检测到您的电脑没有安装flash player,现在是否去官方下载所需插件?", "检测提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dialog == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start("http://get.adobe.com/cn/flashplayer/");
                }
                else
                {
                    Application.Exit();
                }
            }
            else
            {
                frmMain f = new frmMain();
                this.Hide();
                Application.DoEvents();//中间加这句
                f.ShowDialog();
            }

 

winform检测是否安装了flash

 RegistryKey keyroot = Registry.ClassesRoot;
            string flashkey = @"CLSID\{D27CDB6E-AE6D-11cf-96B8-444553540000}";
            RegistryKey rkFlash = keyroot.OpenSubKey(flashkey);
            if (rkFlash == null)
            {
                System.Diagnostics.Process.Start(Application.StartupPath + "\\flash10.exe");
            }

flash player安装文件放在bin目录下

posted @ 2013-01-10 11:47  阿猫小覃  阅读(193)  评论(0编辑  收藏  举报