关于跨线程访问窗体控件
/// <summary>
/// 跨线程设置或获取控件属性
/// </summary>
/// <param name= "Ctrs "> 控件集合 </param>
/// <param name= "CtrName "> 控件名称 </param>
/// <param name= "ProName "> 控件属性 </param>
/// <param name= "Type "> 操作类型:get.获取 set.设置 </param>
/// <param name= "Value "> 值 </param>
private void Thread_Access(System.Windows.Forms.Control.ControlCollection Ctrs, string CtrName, string ProName, string Type, ref string Value)
{
foreach (Control ctr in Ctrs)
{
if (ctr.Controls.Count > 0)
{
Thread_Access(ctr.Controls, CtrName, ProName, Type, ref Value);
}
if ((ctr.Name == CtrName) && (Type == "set "))
{
switch (ProName)
{
case "Text ":
if (ctr.InvokeRequired)
{
SetCallback d = new SetCallback(Thread_Access);