加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

winform小记

发布时间:2020-12-15 18:47:28 所属栏目:百科 来源:网络整理
导读:FormBorderStyle:None让边框消失 private int time = 5;//停止五秒 //计时器 private void timer1_Tick(object sender,EventArgs e) { if (time!=0) { time; } else { this.timer1.Stop(); UserThisFunction(); } } 让程序停止几秒,我是这样做的。如果用线

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目录下

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读