释放轨迹栏控件的问题 [英] problems with releasing trackbar control

查看:72
本文介绍了释放轨迹栏控件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道我将如何释放轨迹栏的控制权吗?

目前,我有一个tb,其值已分配给文本框...


Does anybody know how I would go about releasing the control of a trackbar?

At the moment, I have a tb with its value assigned to a textbox...


private: System::Void trackBar1_Scroll(System::Object^  sender, System::EventArgs^  e)
{
    if(btn_clicked == TRUE)
    {
            textBox1->Text = String::Concat("", trackBar1->Value );     //assigns trackbar value into text box.
            motor_val_1 = int::Parse(textBox1->Text);               //store as global variable...
            motor_one_moved = TRUE;

    }



然后在发生某个事件之后,需要将轨迹栏设置为特定的值...但是随后需要释放对tb的控制,以便可以通过拖动滑块来再次更改其值...



Then after a certain event, the trackbar needs to be set at a particular value...but then control of the tb needs to be released so its value can once again be changed by dragging the slider bar...

else
            {
            Motor1_lbl->Text = "Motor One: Stalled";
            textBox5->Text = "bollocks";
            trackBar2->Value = 7;                                            //works, but needs to be reset.
        }



目前,当我单击轨迹栏时,分配的文本框中包含的值将更改,但指针不会移动.我似乎在titerweb上找不到任何答案,因此任何建议都将得到极大的应用.

感谢您查找



at the moment, the value contained within the assigned textbox will change when I click on the trackbar, but the pointer will not move. I can''t seem to find any answers on the titerweb so any suggestions would be greatly appriciated.

Thanks for looking

推荐答案

您可以调用ReleaseCapture释放它.检查链接以获取更多信息:

http://msdn.microsoft.com/en-us/library/ms646261%28v = VS.85%29.aspx [ ^ ]

旁注,如果没有这种使用winapi的直接交互,可能有更好的方法来做您想要的事情.也许改用change事件怎么样?

祝你好运!
You could call ReleaseCapture to release it. Check the link for more info:

http://msdn.microsoft.com/en-us/library/ms646261%28v=VS.85%29.aspx[^]

As sidenote, there is probably a better way of doing what you want without these kind of direct interactions using winapi. How about maybe using the change event instead?

Good luck!


只是为了让你知道,这就是我的解决方法...

just to let you know, here''s how I got around it...

if(bool_motor1_stall == FALSE)
        {
            Motor1_lbl->Text = "Motor One: OK";
            this->trackBar2->Scroll += gcnew System::EventHandler(this, &Form1::trackBar2_Scroll);
        }

        else
            {
            Motor1_lbl->Text = "Motor One: Stalled";
            textBox5->Text = Convert::ToString(q);
            trackBar2->Value = q;
            }


这篇关于释放轨迹栏控件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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