04.11.2014 Views

编程资料- 多线程 - 错误提示:发生了异常- 博客园

编程资料- 多线程 - 错误提示:发生了异常- 博客园

编程资料- 多线程 - 错误提示:发生了异常- 博客园

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C# 一 个 多 线 程 操 作 控 件 的 例 子 .<br />

// 多 线 程 间 控 件 的 操 作 例 子<br />

using System;<br />

using System.Collections.Generic;<br />

using System.ComponentModel;<br />

using System.Data;<br />

using System.Drawing;<br />

using System.Text;<br />

using System.Windows.Forms;<br />

using System.Threading;<br />

using System.Data.SqlClient;<br />

using System.Collections;<br />

namespace AutoMessager<br />

{<br />

delegate void myDelegate();<br />

delegate void SetTextCallback(string text);<br />

public partial class frmAutoMsg : Form<br />

{<br />

event myDelegate myEvent;<br />

string connStr = string.Empty;<br />

Thread thd;<br />

//private Icon eyeIcon;<br />

//private NotifyIconEx notifyIconA;<br />

//private NotifyIconEx notifyIconB;<br />

private bool canClosed = false;<br />

public frmAutoMsg()<br />

{<br />

this.ShowInTaskbar = false;<br />

InitializeComponent();<br />

//eyeIcon = new Icon(GetType(), "EYE.ICO");<br />

notifyIcon1.ContextMenu = contextMenuB;<br />

}<br />

private void SetText(string text)<br />

{<br />

// InvokeRequired required compares the thread ID of the<br />

// calling thread to the thread ID of the creating thread.<br />

// If these threads are different, it returns true.<br />

if (this.txtMsgStatus.InvokeRequired)<br />

{

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!