⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opcgroupreadmaxagesampleform.cs

📁 利用OpcNet控件(包含源码)进行OPC通讯的开发样例
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using System.Runtime.InteropServices;

using HaiGrang.Package.OpcNetApiChs.Opc;
using HaiGrang.Package.OpcNetApiChs.Da;
using HaiGrang.Package.OpcNetApiChs.DaNet;

namespace OpcGroupReadMaxAgeSample
{
	/// <summary>
	/// OpcGroupReadMaxAgeSample 的摘要说明。
	/// </summary>

	public class OpcGroupReadMaxAgeSampleForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label OpcItemLength;
		private System.Windows.Forms.Button ReadOpcItemMaxAge;
		private System.Windows.Forms.Label OpcItemValue5;
		private System.Windows.Forms.Label OpcItemValue4;
		private System.Windows.Forms.Label OpcItemValue3;
		private System.Windows.Forms.Label OpcItemValue2;
		private System.Windows.Forms.Label OpcItemValue1;
		private System.Windows.Forms.Label OpcRemoveItemName;
		private System.Windows.Forms.Button RemoveOpcItem;
		private System.Windows.Forms.Label OpcItemName;
		private System.Windows.Forms.Button AddOpcItem;
		private System.Windows.Forms.Label OpcRemoveGroupName;
		private System.Windows.Forms.Button RemoveOpcGroup;
		private System.Windows.Forms.Label OpcGroupName;
		private System.Windows.Forms.Button AddOpcGroup;
		private System.Windows.Forms.Button OpcServerDisConnect;
		private System.Windows.Forms.Label OpcServerRemove;
		private System.Windows.Forms.Label bOpcServerName;
		private System.Windows.Forms.Button bOpcServerConnect;
		private System.Windows.Forms.Button ReadOpcValuesMaxAgeItem;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		
		private System.ComponentModel.Container components = null;

		public OpcGroupReadMaxAgeSampleForm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(tOpcServer != null)
				{
					tOpcServer.Disconnect() ;
				}
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.OpcItemLength = new System.Windows.Forms.Label();
			this.ReadOpcItemMaxAge = new System.Windows.Forms.Button();
			this.OpcItemValue5 = new System.Windows.Forms.Label();
			this.OpcItemValue4 = new System.Windows.Forms.Label();
			this.OpcItemValue3 = new System.Windows.Forms.Label();
			this.OpcItemValue2 = new System.Windows.Forms.Label();
			this.OpcItemValue1 = new System.Windows.Forms.Label();
			this.OpcRemoveItemName = new System.Windows.Forms.Label();
			this.RemoveOpcItem = new System.Windows.Forms.Button();
			this.OpcItemName = new System.Windows.Forms.Label();
			this.AddOpcItem = new System.Windows.Forms.Button();
			this.OpcRemoveGroupName = new System.Windows.Forms.Label();
			this.RemoveOpcGroup = new System.Windows.Forms.Button();
			this.OpcGroupName = new System.Windows.Forms.Label();
			this.AddOpcGroup = new System.Windows.Forms.Button();
			this.OpcServerDisConnect = new System.Windows.Forms.Button();
			this.OpcServerRemove = new System.Windows.Forms.Label();
			this.bOpcServerName = new System.Windows.Forms.Label();
			this.bOpcServerConnect = new System.Windows.Forms.Button();
			this.ReadOpcValuesMaxAgeItem = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// OpcItemLength
			// 
			this.OpcItemLength.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemLength.Location = new System.Drawing.Point(576, 48);
			this.OpcItemLength.Name = "OpcItemLength";
			this.OpcItemLength.Size = new System.Drawing.Size(216, 32);
			this.OpcItemLength.TabIndex = 154;
			this.OpcItemLength.Text = "Opc Item Length";
			this.OpcItemLength.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// ReadOpcItemMaxAge
			// 
			this.ReadOpcItemMaxAge.Location = new System.Drawing.Point(576, 432);
			this.ReadOpcItemMaxAge.Name = "ReadOpcItemMaxAge";
			this.ReadOpcItemMaxAge.Size = new System.Drawing.Size(216, 32);
			this.ReadOpcItemMaxAge.TabIndex = 150;
			this.ReadOpcItemMaxAge.Text = "Read Opc MaxAge Item";
			this.ReadOpcItemMaxAge.Click += new System.EventHandler(this.ReadOpcItemMaxAge_Click);
			// 
			// OpcItemValue5
			// 
			this.OpcItemValue5.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemValue5.Location = new System.Drawing.Point(576, 368);
			this.OpcItemValue5.Name = "OpcItemValue5";
			this.OpcItemValue5.Size = new System.Drawing.Size(216, 32);
			this.OpcItemValue5.TabIndex = 149;
			this.OpcItemValue5.Text = "Opc Item Value";
			this.OpcItemValue5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// OpcItemValue4
			// 
			this.OpcItemValue4.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemValue4.Location = new System.Drawing.Point(576, 304);
			this.OpcItemValue4.Name = "OpcItemValue4";
			this.OpcItemValue4.Size = new System.Drawing.Size(216, 32);
			this.OpcItemValue4.TabIndex = 148;
			this.OpcItemValue4.Text = "Opc Item Value";
			this.OpcItemValue4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// OpcItemValue3
			// 
			this.OpcItemValue3.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemValue3.Location = new System.Drawing.Point(576, 240);
			this.OpcItemValue3.Name = "OpcItemValue3";
			this.OpcItemValue3.Size = new System.Drawing.Size(216, 32);
			this.OpcItemValue3.TabIndex = 147;
			this.OpcItemValue3.Text = "Opc Item Value";
			this.OpcItemValue3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// OpcItemValue2
			// 
			this.OpcItemValue2.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemValue2.Location = new System.Drawing.Point(576, 176);
			this.OpcItemValue2.Name = "OpcItemValue2";
			this.OpcItemValue2.Size = new System.Drawing.Size(216, 32);
			this.OpcItemValue2.TabIndex = 146;
			this.OpcItemValue2.Text = "Opc Item Value";
			this.OpcItemValue2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// OpcItemValue1
			// 
			this.OpcItemValue1.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemValue1.Location = new System.Drawing.Point(576, 112);
			this.OpcItemValue1.Name = "OpcItemValue1";
			this.OpcItemValue1.Size = new System.Drawing.Size(216, 32);
			this.OpcItemValue1.TabIndex = 145;
			this.OpcItemValue1.Text = "Opc Item Value";
			this.OpcItemValue1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// OpcRemoveItemName
			// 
			this.OpcRemoveItemName.BackColor = System.Drawing.Color.Yellow;
			this.OpcRemoveItemName.Location = new System.Drawing.Point(64, 240);
			this.OpcRemoveItemName.Name = "OpcRemoveItemName";
			this.OpcRemoveItemName.Size = new System.Drawing.Size(216, 32);
			this.OpcRemoveItemName.TabIndex = 144;
			this.OpcRemoveItemName.Text = "Opc Remove Item Name";
			this.OpcRemoveItemName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// RemoveOpcItem
			// 
			this.RemoveOpcItem.Location = new System.Drawing.Point(296, 240);
			this.RemoveOpcItem.Name = "RemoveOpcItem";
			this.RemoveOpcItem.Size = new System.Drawing.Size(216, 32);
			this.RemoveOpcItem.TabIndex = 143;
			this.RemoveOpcItem.Text = "Remove Opc Item";
			this.RemoveOpcItem.Click += new System.EventHandler(this.RemoveOpcItem_Click);
			// 
			// OpcItemName
			// 
			this.OpcItemName.BackColor = System.Drawing.Color.Yellow;
			this.OpcItemName.Location = new System.Drawing.Point(64, 176);
			this.OpcItemName.Name = "OpcItemName";
			this.OpcItemName.Size = new System.Drawing.Size(216, 32);
			this.OpcItemName.TabIndex = 142;
			this.OpcItemName.Text = "Opc Item Name";
			this.OpcItemName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// AddOpcItem
			// 
			this.AddOpcItem.Location = new System.Drawing.Point(296, 176);
			this.AddOpcItem.Name = "AddOpcItem";
			this.AddOpcItem.Size = new System.Drawing.Size(216, 32);
			this.AddOpcItem.TabIndex = 141;
			this.AddOpcItem.Text = "Add Opc Item";
			this.AddOpcItem.Click += new System.EventHandler(this.AddOpcItem_Click);
			// 
			// OpcRemoveGroupName
			// 
			this.OpcRemoveGroupName.BackColor = System.Drawing.Color.Yellow;
			this.OpcRemoveGroupName.Location = new System.Drawing.Point(64, 304);
			this.OpcRemoveGroupName.Name = "OpcRemoveGroupName";
			this.OpcRemoveGroupName.Size = new System.Drawing.Size(216, 32);
			this.OpcRemoveGroupName.TabIndex = 140;
			this.OpcRemoveGroupName.Text = "Opc Remove Group Name";
			this.OpcRemoveGroupName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// RemoveOpcGroup
			// 
			this.RemoveOpcGroup.Location = new System.Drawing.Point(296, 304);
			this.RemoveOpcGroup.Name = "RemoveOpcGroup";
			this.RemoveOpcGroup.Size = new System.Drawing.Size(216, 32);
			this.RemoveOpcGroup.TabIndex = 139;
			this.RemoveOpcGroup.Text = "Remove Opc Group";
			this.RemoveOpcGroup.Click += new System.EventHandler(this.RemoveOpcGroup_Click);
			// 
			// OpcGroupName
			// 
			this.OpcGroupName.BackColor = System.Drawing.Color.Yellow;
			this.OpcGroupName.Location = new System.Drawing.Point(64, 112);
			this.OpcGroupName.Name = "OpcGroupName";
			this.OpcGroupName.Size = new System.Drawing.Size(216, 32);
			this.OpcGroupName.TabIndex = 138;
			this.OpcGroupName.Text = "Opc Group Name";
			this.OpcGroupName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// AddOpcGroup
			// 
			this.AddOpcGroup.Location = new System.Drawing.Point(296, 112);
			this.AddOpcGroup.Name = "AddOpcGroup";
			this.AddOpcGroup.Size = new System.Drawing.Size(216, 32);
			this.AddOpcGroup.TabIndex = 137;
			this.AddOpcGroup.Text = "Add Opc Group";
			this.AddOpcGroup.Click += new System.EventHandler(this.AddOpcGroup_Click);
			// 
			// OpcServerDisConnect
			// 
			this.OpcServerDisConnect.Location = new System.Drawing.Point(296, 368);
			this.OpcServerDisConnect.Name = "OpcServerDisConnect";
			this.OpcServerDisConnect.Size = new System.Drawing.Size(216, 32);
			this.OpcServerDisConnect.TabIndex = 136;
			this.OpcServerDisConnect.Text = "Opc Server DisConnect";
			this.OpcServerDisConnect.Click += new System.EventHandler(this.OpcServerDisConnect_Click);
			// 
			// OpcServerRemove
			// 
			this.OpcServerRemove.BackColor = System.Drawing.Color.Yellow;
			this.OpcServerRemove.Location = new System.Drawing.Point(64, 368);
			this.OpcServerRemove.Name = "OpcServerRemove";
			this.OpcServerRemove.Size = new System.Drawing.Size(216, 32);
			this.OpcServerRemove.TabIndex = 135;
			this.OpcServerRemove.Text = "Opc Server Remove";
			this.OpcServerRemove.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// bOpcServerName
			// 
			this.bOpcServerName.BackColor = System.Drawing.Color.Yellow;
			this.bOpcServerName.Location = new System.Drawing.Point(64, 48);
			this.bOpcServerName.Name = "bOpcServerName";
			this.bOpcServerName.Size = new System.Drawing.Size(216, 32);
			this.bOpcServerName.TabIndex = 134;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -