一: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