123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
-
- using DllEapEntity;
- using DllHsms;
- using DllPubInfo;
- 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;
- namespace DllXqManager
- {
- public partial class LayoutDetailBase : Form
- {
- //private int CurrID = 0;
- //private DataSet CurrDs = null;
- public delegate void closeForm();
- public delegate void ModifyEntity(LayoutDetail entity);
- public event closeForm eventcloseForm = null;
- public event ModifyEntity eventModifyEntity = null;
- private LayoutDetail CurrEntity = null;
- public LayoutDetailBase(LayoutDetail control)
- {
- InitializeComponent();
- SetCurrID(control);
- }
- public void SetCurrID(LayoutDetail control)
- {
- InitForm(control);
- }
- private void InitForm(LayoutDetail control)
- {
- CurrEntity = control;
- //用实体的值去赋值界面控件显示的值
- string errorinfo = "";
- int result = DllPubInfo.PubInfo.InitFormControl<LayoutDetail>(panel1, CurrEntity, null, ref errorinfo);
- if (result < 0)
- MessageBox.Show(errorinfo);
- if(CurrEntity.EntityTypeID==EntityType.Machine)
- {
- editTEntityFCode.ReadOnly = true;
- editTEntityFName.ReadOnly = true;
- editIPAddress.ReadOnly = true;
- }
- else
- {
- editTEntityFCode.ReadOnly = false;
- editTEntityFName.ReadOnly = false;
- editIPAddress.ReadOnly = false;
- }
- //if (CurrControl == null)
- //{
- // edit实体代码.Text = "";
- // edit实体名称.Text = "";
- // edit备注.Text = "";
- // editIP地址.Text = "0";
- // editX坐标.Text = "0";
- // editY坐标.Text = "0";
- // edit宽度.Text = "0";
- // edit高度.Text = "0";
- //}
- //else
- //{
- // DataRow row = CurrControl.CurrRow;
- // edit实体代码.Text = row["实体代码"].ToString();
- // edit实体名称.Text = row["实体名称"].ToString();
- // edit备注.Text = row["备注"].ToString();
- // editIP地址.Text = row["IP地址"].ToString();
- // editX坐标.Text = CurrControl.Location.X.ToString();
- // editY坐标.Text = CurrControl.Location.Y.ToString();
- // edit宽度.Text = CurrControl.Size.Width.ToString();
- // edit高度.Text = CurrControl.Size.Height.ToString();
- //}
- }
- private void button1_Click(object sender, EventArgs e)
- {
- InitForm(null);
- }
- //private int CallIUBase()
- //{
- // try
- // {
- // #region//构造数据集结构
- // DataRow newrow = CurrDs.Tables[0].Rows[0];
- // newrow["代码"] = edit实体代码.Text.Trim();
- // newrow["名称"] = edit实体名称.Text.Trim();
- // newrow["备注"] = edit备注.Text.Trim();
- // newrow["Offset"] =editIP地址.Text;
- // newrow["分辨率X"] = editX坐标.Text;
- // newrow["分辨率Y"] =editY坐标.Text;
- // newrow["参数1"] =edit宽度.Text;
- // newrow["参数2"] =edit高度.Text;
- // #endregion
- // string errorinfo = "";
- // int result = DllDataAcc.XqConsoleAcc.IUTLcd(CurrDs, ref errorinfo);
- // if(result<0)
- // {
- // MessageBox.Show("操作发生错误,错误信息为:" + errorinfo, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
- // }
- // return result;
- // }
- // catch (Exception e)
- // {
- // MessageBox.Show("操作发生错误,错误信息为:" + e.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
- // return -11;
- // }
- //}
- private void button2_Click(object sender, EventArgs e)
- {
- //DataRow row = CurrControl.CurrRow;
- //row["备注"] = edit备注.Text;
- //row["实体名称"] = edit实体名称.Text;
- //CurrControl.Location = new Point(int.Parse(editX坐标.Text), int.Parse(editY坐标.Text));
- //CurrControl.Size = new Size(int.Parse(edit宽度.Text), int.Parse(edit高度.Text));
- ////if((CurrControl.Tag as MoveControl).fc!=null)
- ////{
- //// (CurrControl.Tag as MoveControl).fc.Visible = false;
- //// MoveControl.DrawDragBound(CurrControl);
- //// (CurrControl.Tag as MoveControl).fc.Draw();
- //// (CurrControl.Tag as MoveControl).fc.Visible = true;
- ////}
- //////CurrControl.Refresh();
- //CurrControl.Parent.Refresh();//刷新父容器,清除掉其他控件的边框
- //CurrControl.BringToFront();
- //FrameControl fc = new FrameControl(CurrControl);
- //CurrControl.Parent.Controls.Add(fc);
- //fc.Visible = true;
- //fc.Draw();
- string errorinfo = "";
- int result = PubInfo.UpdateRowFormControl(panel1, CurrEntity, ref errorinfo);
- if (result < 0)
- {
- MessageBox.Show("更新数据发生错误:" + errorinfo);
- return;
- }
- eventModifyEntity?.Invoke(CurrEntity);
- }
- private void mmabase_FormClosing(object sender, FormClosingEventArgs e)
- {
- eventcloseForm?.Invoke();
- }
- public void Selmma(DataRow row)
- {
- //if(row==null)
- //{
- // edit机型代码.Text = "";
- // return;
- //}
- //edit机型代码.Text = row["代码"].ToString();
- }
- private void btEmail_Click(object sender, EventArgs e)
- {
- //mmaquery temp = new mmaquery();
- //temp.eventselrow += Selmma;
- //temp.ShowDialog();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- //if (CurrDs == null)
- //{
- // InitForm(0);
- // return;
- //}
- //CurrID = 0;
- //CurrDs.Tables[0].Rows[0]["id"] = 0;
- //edit代码.Text = "";
- }
- }
- }
|