Invoke(delegateMethod)参数计数不匹配

private void WriteLabel(string s)
        {
            if (label1.InvokeRequired)
            {
                WriteLabelDeletegate d = new WriteLabelDeletegate(WriteLabel);
                label1.Invoke(d);
            }
            else
            {
                label1.Text = s;
            }
        }

 

报错:参数计数不匹配

改后

private void WriteLabel(string s)
        {
            if (label1.InvokeRequired)
            {
                WriteLabelDeletegate d = new WriteLabelDeletegate(WriteLabel);
                label1.Invoke(d, new object[] { s });
            }
            else
            {
                label1.Text = s;
            }
        }

posted @   alex hu  阅读(5194)  评论(1编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示