private delegate void SetLabelTextCallBack(Label l, String text); /// <summary> /// 为 Label 控件设置 Text 文本 /// </summary> /// <param name="l">Label</param> /// <param name="text">Text</param> private void SetLabelText(Label l, String text) { if (l.InvokeRequired) { SetLabelTextCallBack call = new SetLabelTextCallBack(SetLabelText); this.Invoke(call, new object[] { l, text }); } else { l.Text = text; } }
经常会用到,但是很奇怪却总是想不起来,所以咱记下来以便以后随时查看