1 Star 0 Fork 0

毛雄斌/WindowsFormsApp2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Form3.cs 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
毛雄斌 提交于 2019-07-02 21:37 . 完成基本的操作
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using S7.Net;
namespace WindowsFormsApp2
{
public partial class Form3 : Form
{
public Form1 form1;
public Form3(Form1 form)
{
form1 = form;
InitializeComponent();
this.co_varType.Items.Clear();
this.co_varType.Items.AddRange(Enum.GetNames(typeof(VarType)));
this.co_plcAreaType.Items.Clear();
this.co_plcAreaType.Items.AddRange(Enum.GetNames(typeof(DataType)));
}
private void Label1_Click(object sender, EventArgs e)
{
}
private void Bt_varAddCheck_Click(object sender, EventArgs e)
{
TreeNode CurSelectedNode = form1.treeView1.SelectedNode;
var CurPlc = form1.Pmg.FindPLCByName(CurSelectedNode.Name);
var varName = tx_varName.Text;
var datatype = (DataType)Enum.Parse(typeof(DataType), co_plcAreaType.Text);
var db = int.Parse(DBNumber.Text);
var startAddr = int.Parse(tx_varAddr.Text);
var varType = (VarType)Enum.Parse(typeof(VarType), co_varType.Text);
var count = int.Parse(tx_varLenth.Text);
var bitNumber = (Byte)int.Parse(tx_varBitAddr.Text);
var s7PlcValItem = new s7plcVarItem(form1.VarGridView,CurPlc,varName ,datatype,db,startAddr,varType,count,bitNumber);
s7PlcValItem.Node.ContextMenuStrip = form1.varContextStrip;
s7PlcValItem.TreeView1 = form1.treeView1;
CurPlc.Add(s7PlcValItem);
this.DialogResult = DialogResult.OK;
}
private void Label6_Click(object sender, EventArgs e)
{
}
private void Label7_Click(object sender, EventArgs e)
{
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/mao_qin_bin/WindowsFormsApp2.git
git@gitee.com:mao_qin_bin/WindowsFormsApp2.git
mao_qin_bin
WindowsFormsApp2
WindowsFormsApp2
master

搜索帮助