private void dgvINS_CellClick(object sender, DataGridViewCellEventArgs e) { gpMode = Page_Mode.EDIT; DataGridView dgvProc = (DataGridView)sender; DataTable dtProc = (DataTable)dgvProc.DataSource; lbINS_NO.Text = dtProc.Rows[e.RowIndex][0].ToString() + "_" + dtProc.Rows[e.RowIndex][1].ToString() + "_" + dtProc.Rows[e.RowIndex][2].ToString() + "_" + dtProc.Rows[e.RowIndex][4].ToString(); LoadINS_Detail(lbINS_NO.Text); }
/// <summary> /// 添加定义的纸张类型 /// </summary> public static void Initialize_PageMode() { for (int i = 0; i < 24; i++) { Page_Mode pm = new Page_Mode(); pm.page_Type = page_types[i]; pm._tag = i; string[] splitString = page_pixel[i].Split(new string[] { "×" }, StringSplitOptions.None); pm.page_Direction[0] = new Size(int.Parse(splitString[0]), int.Parse(splitString[1]) + 13 + 126); pm.page_Direction[1] = new Size(int.Parse(splitString[1]), int.Parse(splitString[0]) + 13 + 126); //pm.page_Direction[1] = new Size(int.Parse(splitString[1]+13), int.Parse(splitString[0]) + 126); page_Modes.Add(pm); } }
private void btnSave_Click(object sender, EventArgs e) { if (tbART_NO.Text.Length > 0 && dgvO1.Rows.Count > 0) { if (gpMode == Page_Mode.EDIT) { gpMode = Page_Mode.ADD; MessageBox.Show("舊版本不會覆蓋,會另存新檔!"); CreateNo(); } Save(); } else { MessageBox.Show("請輸入布號與疋號資料!"); } }
private void Init() { gpMode = Page_Mode.ADD; //Load EQP LoadEQP(); //LoadINS LoadINS_DATA(); //Load Reason string ssql = SQL_TEXT.Q_REASON_CODE; DataTable dtReasonCode = dbTool.QueryData(ssql); dReason.Clear(); foreach (DataRow dr in dtReasonCode.Rows) { Reason_Item ri = new Reason_Item(); ri.Reason_code = dr[0].ToString(); ri.Reason = dr[1].ToString(); ri.Point = dr[2].ToString(); dReason.Add(ri); } for (int i = 1; i <= 4; i++) { Label lbY = (Label)this.Controls.Find("lbY" + i, true)[0]; Label lbPts = (Label)this.Controls.Find("lbPts" + i, true)[0]; Label lbG = (Label)this.Controls.Find("lbG" + i, true)[0]; lbY.Text = ""; lbPts.Text = ""; lbG.Text = ""; } #region Init Shift combobix //Init Shift combobix foreach (Control s in this.tableLayoutPanel2.Controls) { if (s is Panel) { foreach (Control s1 in s.Controls) { if (s1.Name.Contains("cbS")) { ComboBox cb = (ComboBox)s1; cb.Items.Clear(); cb.Items.Add("A"); cb.Items.Add("B"); cb.Items.Add("C"); cb.SelectedIndex = 0; cb.DropDownStyle = ComboBoxStyle.DropDownList; } if (s1.Name.Contains("cbR")) { ComboBox cb = (ComboBox)s1; cb.Items.Clear(); foreach (Reason_Item r in dReason) { ComboxItem cItem = new ComboxItem(); cItem.Text = r.Reason_code + "-" + r.Reason; cItem.Value = r.Reason_code; cb.Items.Add(cItem); } //cb.SelectedIndex = 0; cb.DropDownStyle = ComboBoxStyle.DropDownList; } } } } cbS0.Items.Clear(); cbS0.Items.Add("A"); cbS0.Items.Add("B"); cbS0.Items.Add("C"); cbS0.SelectedIndex = 0; cbS0.DropDownStyle = ComboBoxStyle.DropDownList; #endregion //Init Table Layout this.tableLayoutPanel2.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; #region Event Handler //Event btnAddO1.Click += btnAddO1_Click; btnAddO2.Click += btnAddO1_Click; btnAddO3.Click += btnAddO1_Click; btnAddO4.Click += btnAddO1_Click; btnDelO1.Click += btnDelO1_Click; btnDelO2.Click += btnDelO1_Click; btnDelO3.Click += btnDelO1_Click; btnDelO4.Click += btnDelO1_Click; btnAddR1.Click += btnAddR1_Click; btnAddR2.Click += btnAddR1_Click; btnAddR3.Click += btnAddR1_Click; btnAddR4.Click += btnAddR1_Click; btnDelR1.Click += btnDelR1_Click; btnDelR2.Click += btnDelR1_Click; btnDelR3.Click += btnDelR1_Click; btnDelR4.Click += btnDelR1_Click; dgvO1.CellClick += dgvO1_CellClick; dgvO2.CellClick += dgvO1_CellClick; dgvO3.CellClick += dgvO1_CellClick; dgvO4.CellClick += dgvO1_CellClick; dgvR1.CellClick += dgvR1_CellClick; dgvR2.CellClick += dgvR1_CellClick; dgvR3.CellClick += dgvR1_CellClick; dgvR4.CellClick += dgvR1_CellClick; cbR1.SelectedIndexChanged += cbR1_SelectedIndexChanged; cbR2.SelectedIndexChanged += cbR1_SelectedIndexChanged; cbR3.SelectedIndexChanged += cbR1_SelectedIndexChanged; cbR4.SelectedIndexChanged += cbR1_SelectedIndexChanged; tbS12.KeyDown += tbS12_KeyDown; tbS22.KeyDown += tbS12_KeyDown; tbS32.KeyDown += tbS12_KeyDown; tbS42.KeyDown += tbS12_KeyDown; tbR11.KeyDown += tbS12_KeyDown; tbR21.KeyDown += tbS12_KeyDown; tbR31.KeyDown += tbS12_KeyDown; tbR41.KeyDown += tbS12_KeyDown; tbS11.KeyPress += textBox1_KeyPress; tbS12.KeyPress += textBox1_KeyPress; tbS21.KeyPress += textBox1_KeyPress; tbS22.KeyPress += textBox1_KeyPress; tbS31.KeyPress += textBox1_KeyPress; tbS32.KeyPress += textBox1_KeyPress; tbS41.KeyPress += textBox1_KeyPress; tbS42.KeyPress += textBox1_KeyPress; tbR11.KeyPress += textBox1_KeyPress; tbR21.KeyPress += textBox1_KeyPress; tbR31.KeyPress += textBox1_KeyPress; tbR41.KeyPress += textBox1_KeyPress; #endregion }