public UserControlCom(UserControlBase ub, string com, SERIALData serialValueData, bool configured = false) { InitializeComponent(); UserControl1 us = ub.parent_ as UserControl1; setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeComEthNodeStats); serialValueData_ = serialValueData; //串口名 com_ = com; //configured为true,串口数据加载config_project //configured为false,串口数据加载控制器模板数据 configured_ = configured; if (serialValueData_.terminalResis == HAS_BOTH) { radioButton1.Enabled = true; radioButton2.Enabled = true; } else if (serialValueData_.terminalResis == HAS_RS485) { radioButton2.Enabled = false; } if (serialValueData.databitEnable == DATABIE_DISENABLE) { comboBox_Databit.Enabled = false; } else if (serialValueData_.databitEnable == DATABIE_ENABLE) { comboBox_Databit.Enabled = true; } initDone = false; if (configured_) { Init(); setDataToUI(); } else { Init(); } initDone = true; //数据管理里的串口数组 //UserControlBase.dataManage.serialDic.Add(com_, serialValueData); setButtonEnable(false); }
public UserControlDI(UserControl1 us) { InitializeComponent(); //text_Temp.PreviewKeyDown += OnPreviewKeyDown; //text_Temp.KeyDown += OnKeyDown; setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeNodeStatus); Pub.CRichTestBoxMenu richMenu = new Pub.CRichTestBoxMenu(text_Temp, dataGridView1); text_Temp.MaxLength = 30; this.dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect; //InitDatable(); //InitTableData(); // 绑定性别下拉列表框 //BindSex(); ////绑定数据表 BindData(); // 设置下拉列表框不可见 cmb_Temp.Visible = false; //添加下拉列表框事件 cmb_Temp.SelectedIndexChanged += new EventHandler(cmb_Temp_SelectedIndexChanged); text_Temp.TextChanged += new System.EventHandler(textBox1_TextChanged); text_Temp.Visible = false; text_Temp.WordWrap = false; text_Temp.ScrollBars = RichTextBoxScrollBars.None; //text_Temp.setParent(dataGridView1); //将下拉列表框加入到DataGridView控件中 this.dataGridView1.Controls.Add(cmb_Temp); this.dataGridView1.Controls.Add(text_Temp); //最后一列自动填充表格 dataGridView1.Columns[columnVarIndex].Width = 200; dataGridView1.Columns[columnUsed].Width += 10; //禁止用户改变DataGridView1の所有行的行高 dataGridView1.AllowUserToResizeRows = false; //最后一列填充表格 dataGridView1.Columns[dataGridView1.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; //this.dataGridView1.Columns[2].DisplayIndex = 1; for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } }
public UserControlHighIn(UserControl1 us) { InitializeComponent(); setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeNodeStatus); Pub.CRichTestBoxMenu richMenu = new Pub.CRichTestBoxMenu(text_Temp, dataGridView1); init = true; typeDescDic.Clear(); typeDescDic.Add(((int)TYPE.NOTUSED), "未配置"); typeDescDic.Add(((int)TYPE.SINGLEPULSE), "单相"); typeDescDic.Add(((int)TYPE.DOUBLEPULSE), "双相"); typeDescDic.Add(((int)TYPE.FREQUENCY), "频率计"); BindData(); text_Temp.TextChanged += new System.EventHandler(textBox1_TextChanged); text_Temp.Visible = false; text_Temp.WordWrap = false; text_Temp.ScrollBars = RichTextBoxScrollBars.None; text_Temp.MaxLength = 30; this.dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect; dataGridView1.Controls.Add(text_Temp); //禁止用户改变DataGridView1の所有行的行高 dataGridView1.AllowUserToResizeRows = false; //列太多,去掉最后一行填充表格 dataGridView1.Columns[dataGridView1.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } // 禁止用户改变列头的高度 dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; init = false; button_valid.Enabled = false; button_cancel.Enabled = false; }
public UserControlDO(/*string name, */ UserControl1 us) { InitializeComponent(); setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeNodeStatus); this.dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect; text_Temp.MaxLength = 30; setButtonEnable(false); //this.DoubleBuffered = true; //this.DoubleBuffered = true;//设置本窗体 //SetStyle(ControlStyles.UserPaint, true); //SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. //SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 BindData(); Pub.CRichTestBoxMenu richMenu = new Pub.CRichTestBoxMenu(text_Temp, dataGridView1); // 设置下拉列表框不可见 text_Temp.Visible = false; text_Temp.TextChanged += new System.EventHandler(textBox1_TextChanged); //this.text_Temp.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.richTextBox1_PreviewKeyDown); text_Temp.WordWrap = false; text_Temp.ScrollBars = RichTextBoxScrollBars.None; this.dataGridView1.Controls.Add(text_Temp); //禁止用户改变DataGridView1の所有行的行高 dataGridView1.AllowUserToResizeRows = false; dataGridView1.Columns[columnVarIndex].Width = 200; dataGridView1.Columns[columnUsedIndex].Width += 10; //dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[dataGridView1.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } }
public UserControlHighOutput(UserControl1 us) { InitializeComponent(); setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeNodeStatus); typeDescDic.Clear(); typeDescDic.Add(((int)TYPE.NOTUSED), "未配置"); typeDescDic.Add(((int)TYPE.PLS), "PLS"); typeDescDic.Add(((int)TYPE.PWM), "PWM"); typeDescDic.Add(((int)TYPE.FREQUENCY), "FREQUENCY"); typeDescDic.Add(((int)TYPE.PTO), "PTO"); BindData(); text_Temp.TextChanged += new System.EventHandler(textBox1_TextChanged); text_Temp.Visible = false; text_Temp.WordWrap = false; //不显示滚动条 text_Temp.ScrollBars = RichTextBoxScrollBars.None; dataGridView1.Controls.Add(text_Temp); //禁止用户改变DataGridView1の所有行的行高 dataGridView1.AllowUserToResizeRows = false; //列太多,去掉最后一行填充表格 dataGridView1.Columns[dataGridView1.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } // 禁止用户改变列头的高度 dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; }
public UserControlEth(UserControlBase ub, string name, ETHERNETData ethernetValueData, bool configured = false) { InitializeComponent(); UserControl1 us = ub.parent_ as UserControl1; setTreeNodeStatusDelegate = new setTreeNodeStatusEventHandler(us.setTreeComEthNodeStats); ethernetValueData_ = ethernetValueData; configured_ = configured; etherName = name; var v = ipAddressControl_ipaddr.IPAddress; setButtonEnable(false); init(); //数据管理里的网口数组 LocalPLC一般是1个网口 //UserControlBase.dataManage.ethernetDic.Add(etherName, ethernetValueData_); var s = "0.0.0.0"; string maskAddress = "0.0.0.0"; try { //IP ipAddressControl_ipaddr.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.ipAddress); //mask ipAddressControl_maskaddr.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.maskAddress); //gateway ipAddressControl_gateway.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.gatewayAddress); //sntp ipAddressControl_sntpaddr.IPAddress = System.Net.IPAddress.Parse(ethernetValueData_.sntpServerIp); //1 dhcp 0固定 if (ethernetValueData_.ipMode == 1) { radioButton_dhcp.Checked = true; radioButton_fixed.Checked = false; } else { radioButton_dhcp.Checked = false; radioButton_fixed.Checked = true; } if (ethernetValueData_.checkSNTP == 0) { checkBox_SNTP.Checked = false; } else { checkBox_SNTP.Checked = true; } textBox_eth.Text = etherName; } catch (Exception e) { MessageBox.Show(string.Format("{1}模块{0}", e.Message, etherName)); } initDone = true; }