AxisShowControl.cs
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace UserFromControl
{
public partial class AxisShowControl : UserControl
{
public int AxisNo { get; set; }
public int CommandValue { get; set; }
public int PositionValue { get; set; }
public int MontionValue { get; set; }
public int IoStatusValue { get; set; }
public int ErrorPosition { get; set; }
public int TargetPosition { get; set; }
List<IOStatusControl> ioStatusList = new List<IOStatusControl>();
public void BingData(int axisNO, int command, int position, int io, int montion, int errorPositon,int targetPosition)
{
this.AxisNo = axisNO;
this.CommandValue = command;
this.PositionValue = position;
this.MontionValue = montion;
this.IoStatusValue = io;
this.ErrorPosition = errorPositon;
this.TargetPosition = targetPosition;
}
public void ShowData()
{
box.Text = "Axis " + AxisNo;
txtCommand.Text = CommandValue.ToString();
txtErrorPosition.Text = ErrorPosition.ToString();
string ioStatus = Convert.ToString(IoStatusValue, 2).PadLeft(9, '0');
txtIoStatus.Text = ioStatus;
String monIoStr = Convert.ToString(MontionValue, 2).PadLeft(9, '0');
txtMontion.Text = monIoStr;
txtPosition.Text = PositionValue.ToString();
txtTargetPosition.Text = TargetPosition.ToString();
////循环io状态
//for (int i = 0; i < ioStatusList.Count(); i++)
//{
// string value = ioStatus.Substring(i, 1);
// ioStatusList[i].IOValue = Convert.ToInt32(value);
// ioStatusList[i].ShowData();
//}
}
public AxisShowControl()
{
InitializeComponent();
}
private void AxisShowControl_Load(object sender, EventArgs e)
{
//ioStatusList.Add(ioStatusControl9);
//ioStatusList.Add(ioStatusControl4);
//ioStatusList.Add(ioStatusControl3);
//ioStatusList.Add(ioStatusControl2);
//ioStatusList.Add(ioStatusControl1);
//ioStatusList.Add(ioStatusControl5);
//ioStatusList.Add(ioStatusControl6);
//ioStatusList.Add(ioStatusControl7);
//ioStatusList.Add(ioStatusControl8);
}
}
}