所以我希望能够在不点击标签的情况下在标签上显示消息。
public void servicestatus_Click_1(object sender, EventArgs e)
{
var mavbridgeservice = new System.ServiceProcess.ServiceController("MavBridge");
if (mavbridgeservice.Status == ServiceControllerStatus.Running)
{
servicestatus.Text = ("The service is running!");
}
else
{
servicestatus.Text = "The service is stopped!";
}
}
我将(null,null)绑定在(object sender,EventArgs e)中,但这给出了错误,我不知道为什么。我里面的代码与任何点击都没有任何关联。