110,539
社区成员
发帖
与我相关
我的任务
分享
public class dllTest
{
public AxActQJ71E71TCP PlcSocket = null;
public dllTest(ref AxActQJ71E71TCP _PlcSocket)
{
PlcSocket = _PlcSocket;
}
public override bool HandControlValve7_Value()
{
this._szDevice = "D136";
eData = new int[4] { 1, 2, 3, 4 };
int iRet = PlcSocket.EntryDeviceStatus(this._szDevice,1, 1, ref _eData[0]);
PlcSocket.OnDeviceStatus += new _IActQJ71E71TCPEvents_OnDeviceStatusEventHandler(PlcSocket_OnDeviceStatus);
return false;
}
public void PlcSocket_OnDeviceStatus(object sender, _IActQJ71E71TCPEvents_OnDeviceStatusEvent e)
{
if (e.szDevice == "D136")
{
PlcSocket.FreeDeviceStatus();
}
}
}
public AxActQJ71E71TCP GuiPlcSocket = new AxActQJ71E71TCP();
private void button3_Click(object sender, EventArgs e)
{
dllTest dlltst = new dllTest(ref GuiPlcSocket );
dlltst.HandControlValve7_Value();
}
public partial class TextBoxEx : TextBox
{
public event EventHandler ButtonClick;
private void InitializeComponent()
{
...
this.BtnSelect = new System.Windows.Forms.Button();
this.BtnSelect.Click += new System.EventHandler(this.OnButtonClick);
this.Controls.Add(this.BtnSelect);
this.ResumeLayout(false);
}
protected virtual void OnButtonClick(object sender, EventArgs e)
{
if (ButtonClick != null) ButtonClick(this, e);
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.textBoxEx1.ButtonClick += new System.EventHandler(this.textBoxEx1_ButtonClick);
}
private void textBoxEx1_ButtonClick(object sender, EventArgs e)
{
this.Text = textBoxEx1.Text;
}