pulse.Start / Stop如果Checkbox已检查/更改? [英] pulse.Start/Stop if Checkbox Checked/Changed?

查看:99
本文介绍了pulse.Start / Stop如果Checkbox已检查/更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们我是新编码并得到一个快速的问题希望任何人都可以帮助我请或发布一些有用的东西。



是否可以只使用此代码ckeckbox我的意思是,如果选中复选框启用此代码,如果复选框已更改,则禁用它。



  private   void  button18_Click_1( object  sender,EventArgs e)
{
var pulse = new 线程(运行状况);
pulse.Start();
}

private void health()
{
执行
{
_rtm.Poke(0xbE238DD4, 00003A7E);
if (checkBox1.Checked)Thread.Sleep( 500 );
} while (checkBox1.Checked);
status.Text = Inf Health Enabled;
}

解决方案

有两种方法可以做到:

1)添加代码到Click事件处理程序,它查看CheckBox.Checked属性,并且仅在以下情况下继续:

  private   void  button18_Click_1( object  sender,EventArgs e)
{
if (myCheckBox.Checked)
{
var pulse = 线程(健康);
Pulse.Start();
}
}



2)通过处理CheckBox.CheckChanged事件来禁用按钮:

  private   void  myCheckBox_CheckedChanged( object  sender,EventArgs e)
{
button1.Enabled = myCheckBox.Checked;
}


谢谢,但不是我想要的。



hmm我想发送此代码_rtm.Poke(0xbE238DD4,00003A7E); permant(就像一个循环命令)只使用一个复选框,





编辑:



我发布的代码非常适合作为循环命令发送rtm.poke代码

但是我只使用复选框


hey guys im new in coding and got an quick question hope anyone can help me PLEASE or post something usefull.

is it possible to use this code only with the ckeckbox i mean if checkbox checked enable this code and if checkbox changed disable it.

private void button18_Click_1(object sender, EventArgs e)
{
    var pulse = new Thread(health);
    pulse.Start();
}

private void health()
{
    do
    {
        _rtm.Poke(0xbE238DD4, "00003A7E");
        if (checkBox1.Checked) Thread.Sleep(500);
    } while (checkBox1.Checked);
    status.Text = "Inf Health Enabled";
}

解决方案

There are two ways to do it:
1) Add code to the Click event handler which looks at your CheckBox.Checked property, and continues only if it is:

private void button18_Click_1(object sender, EventArgs e)
{
    if (myCheckBox.Checked)
    {
        var pulse = new Thread(health);
        Pulse.Start();
    }
}


2) Disable the button by handling the CheckBox.CheckChanged event:

private void myCheckBox_CheckedChanged(object sender, EventArgs e)
{
    button1.Enabled = myCheckBox.Checked;
}


thank you, but not exacty that i want.

hmm i want send this code _rtm.Poke(0xbE238DD4, "00003A7E"); permant (like an loop command) using only an checkbox,


edit:

the code i posted is working great as an loop command to send the rtm.poke code
but i will use only the checkbox


这篇关于pulse.Start / Stop如果Checkbox已检查/更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆