zoukankan
html css js c++ java
C#(.net) 线程和最小化到托盘的例子
自己写的一个使用线程和最小化到托盘的例子。
例子下载
当你看这个例子你就知道线程的强大了,:-)
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
System.Threading;
using
System.Diagnostics;
namespace
thread
{
public
partial
class
Form1 : Form
{
Thread t1;
public
Form1()
{
InitializeComponent();
this
.notifyIcon1.Visible
=
false
;
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls
=
false
;
}
private
void
button1_Click(
object
sender, EventArgs e)
{
t1
=
new
Thread(
new
ThreadStart(BackGroudProcess));
t1.Start();
}
private
void
BackGroudProcess()
{
int
i
=
1
;
while
(
true
)
{
listBox1.Items.Add(
"
Iterations:
"
+
i.ToString());
i
++
;
}
}
private
void
button2_Click(
object
sender, EventArgs e)
{
t1.Abort();
}
private
void
button3_Click(
object
sender, EventArgs e)
{
int
i
=
1
;
while
(
true
)
{
listBox1.Items.Add(
"
Iterations:
"
+
i.ToString());
i
++
;
}
}
private
void
Form1_Resize(
object
sender, EventArgs e)
{
if
(WindowState
==
FormWindowState.Minimized)
{
this
.Visible
=
false
;
this
.notifyIcon1.Visible
=
true
;
}
}
private
void
notifyIcon1_Click(
object
sender, EventArgs e)
{
this
.Visible
=
true
;
WindowState
=
FormWindowState.Normal;
this
.notifyIcon1.Visible
=
false
;
}
private
void
linkLabel1_LinkClicked(
object
sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(
"
http://wuyisky.cnblogs.com
"
);
}
}
}
源码下载
查看全文
相关阅读:
AOP Aspect 统一日志、异常处理、数据格式
java基本成员默认值
Jackson ObjectMapper
logstash 安装 jdbc-output出错
ElasticSearch定时删除数据(非时间结尾规律索引)
docker安装部署
K8s 使用helm 安装 EFK和ELK分布式日志分析系统系列(es版本:6.7.0;)
JWT 验证
JS查找数组中元素index
oracle not in 失效
原文地址:https://www.cnblogs.com/wuyisky/p/923247.html
最新文章
由serilog帶來的Memory Leak問題
Docker學習
Docker學習
Docker學習
MongoDB在高并發寫情況下保障數據正確性
Sql Server 調優
【转载】ASP.NET第一次访问慢的解决方法(MVC,Web Api)
ABP框架使用(版本3.3.1)
[转载].NET Debugging Labs
[MoocPython课程]Turtlr库绘图之“富士山下”
热门文章
[MoocPython课程]基本数据类型
[MoocPython课程]实例-蟒蛇绘制
[MoocPython课程]实例-1.温度转换
[从零开始学Python]综合实例1
[从零开始学Python]4.文件操作
[从零开始学Python]3.函数
[从零开始学Python]2.分支和循环
百度万年历API 查询 年工作日,法定节假日,调休工作日
springboot使用commons-pool2实现对象池
EasyPoi教程
Copyright © 2011-2022 走看看