C# 利用鼠标控制robot arms移动

一:Form1_Load()
1.控件的属性需在窗体加载函数中修改,在方法类中修改,会执行控件的默认值;
2.控件代码无需添加到窗体加载函数,人为创建的方法添加到控件中,每个控件几乎都有mouse属性;
3.Current timer proforms a refresh every 10ms;

   private void Form1_Load(object sender, EventArgs e)
        {
   
            // panel2.MouseWheel += new MouseEventHandler( Formsamber_MouseWheel);
            //panel2.MouseMove += Control_Mousemove;
            //panel2.MouseUp += label_ControlModule_MouseUp;
            //panel2.MouseDown += Control_Mousedown;
            
            numericUpDown1.Maximum = 200;
            numericUpDown1.Minimum = 1;
            panel2.MouseWheel += Formsamber_MouseWheel;
            pictureBox_draw.MouseWheel += pictureBox_draw_MouseWheel;
            coordinates_X0 = (int)(this.pictureBox_draw.Width / 2);
            coordinates_Y0 = (int)(this.pictureBox_draw.Height / 2 + 100);
            draw_timer = new System.Timers.Timer(10);
            draw_timer.Elapsed += new System.Timers.ElapsedEventHandler(timeout);
            draw_timer.AutoReset = true;
        }

二:窗体加载函数
1.填充颜色,object,起始角度,终止角度 gra.FillPie(Brushes.DarkBlue, rc, 0, 360);
2. 创建多个线程
(1)thread 1=new Thread(test);
public static void test()
{
代码块;
}
(2)thread 1=new Thread(()=>{});
方法名.Invoke(new Action(() => { });

 private void timeout(object source, System.Timers.ElapsedEventArgs e)
        {
   
            try
            {
   
                if (robot == null && !robot.is_connected() && !robot.initial_finish)
                {
   
                    return;
                }
                //机械臂位置等
                robot.get_scara_param();
                pictureBox_draw
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值