// Event: 자료 수정여부를 확인하기 위해 Leave 이벤트와 쌍으로 사용. (MultiBox는 모두 사용) private void inKorName_Enter(object sender, EventArgs e) { MultiBoxControls.GeneralTextBox sd = (MultiBoxControls.GeneralTextBox)sender; if (!changeSW) { mSaveStr = sd.Text; } }
// Event: 자료 수정여부를 확인하기 위해 Enter 이벤트와 쌍으로 사용. (MultiBox는 모두 사용) private void inKorName_Leave(object sender, EventArgs e) { MultiBoxControls.GeneralTextBox sd = (MultiBoxControls.GeneralTextBox)sender; if (!nFirstSW && !changeSW && mSaveStr != sd.Text) { changeSW = true; ChangeButtonStatusAll(false, true, true, false); } }
private void OSPCDepositForm_NoLeave(object sender, EventArgs e) { MultiBoxControls.GeneralTextBox cn = (MultiBoxControls.GeneralTextBox)sender; if (cn.Value != mSaveText) { if (!btnSave.Enabled) { btnSave.Enabled = true; } } }
// // Method: gridTatal 그리드에 입력된 데이터를 기초하여 컨트롤을 만든다. private void EnableControls() { // 기존에 그려진 컨트롤이 있으면 제거한다. int index = 0; if (inBox != null || lblView != null) { foreach (Label lbl in lblView) { panel1.Controls.Remove(lblView[index++]); } index = 0; foreach (MultiBoxControls.GeneralTextBox inb in inBox) { panel1.Controls.Remove(inBox[index++]); } inBox = null; lblView = null; } // 컨트롤을 새로 만들고 그린다. lblView = new List <Label> (); inBox = new List <MultiBoxControls.GeneralTextBox> (); index = 0; int iHeight = nLblY; if (mInsertMode) { for (int i = 1; i < gridTotal.RowCount; i++) { if ((bool)gridTotal["selected", i].Value) { Label lbl = new Label(); MultiBoxControls.GeneralTextBox inb = new MultiBoxControls.GeneralTextBox(); lbl.Visible = false; inb.Visible = false; lbl.AutoSize = false; lbl.Size = nLblSize; lbl.Location = new Point(nLblX, iHeight); lbl.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0); lbl.Text = gridTotal["title", i].Value.ToString(); lbl.TextAlign = ContentAlignment.MiddleCenter; lbl.BackColor = Color.Tan; lbl.Tag = gridTotal["ID", i].Value; // 중요: 항목 코드를 저장 inb.AAStyle = MultiBoxControls.GeneralTextBox.MBStyle.FmDollarCurrency; inb.Location = new Point(nBoxX, iHeight); inb.Font = new System.Drawing.Font("맑은 고딕", 10); inb.Tag = index; // 중요: index를 저장 inb.Size = new System.Drawing.Size(110, 25); inb.TabIndex = index + 1; lblView.Add(lbl); inBox.Add(inb); inBox[index].Leave += new EventHandler(OSPCOffering_inBoxLeave); inBox[index].KeyPress += new KeyPressEventHandler(OSPCOffering_KeyPress); panel1.Controls.Add(lblView[index]); panel1.Controls.Add(inBox[index]); lblView[index].Visible = true; inBox[index++].Visible = true; iHeight += nGapY; } } btnDelete.Visible = false; } else { Label lbl = new Label(); MultiBoxControls.GeneralTextBox inb = new MultiBoxControls.GeneralTextBox(); lbl.Visible = false; inb.Visible = false; lbl.AutoSize = false; lbl.Size = nLblSize; lbl.Location = new Point(nLblX, iHeight); lbl.TextAlign = ContentAlignment.MiddleCenter; lbl.BackColor = Color.Tan; lbl.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0); inb.AAStyle = MultiBoxControls.GeneralTextBox.MBStyle.FmDollarCurrency; inb.Location = new Point(nBoxX, iHeight); inb.Font = new System.Drawing.Font("맑은 고딕", 10); inb.Size = new System.Drawing.Size(110, 25); inb.Tag = index; // 중요: index를 저장 inb.TabIndex = index + 1; lblView.Add(lbl); inBox.Add(inb); inBox[index].Leave += new EventHandler(OSPCOffering_inBoxLeave); inBox[index].KeyPress += new KeyPressEventHandler(OSPCOffering_KeyPress); panel1.Controls.Add(lblView[index]); panel1.Controls.Add(inBox[index]); lblView[index].Visible = true; inBox[index++].Visible = true; iHeight += nGapY; btnDelete.Visible = true; btnDelete.Top = iHeight + 5; } mLastIndex = index; btnSave.Enabled = false; btnSave.Top = iHeight + 5; }
// // Method: gridTatal 그리드를 채움, 로드할 때 한 번만 실행 private void FillGridTotal() { nNo = new List <MultiBoxControls.GeneralTextBox> (); nCheq = new List <MultiBoxControls.GeneralTextBox> (); nCash = new List <MultiBoxControls.GeneralTextBox> (); int iNoX = 120, iCheqX = 170, iCashX = 390, iY = 15, iJump = 30; for (int i = 0; i < nMaxCheq; i++) { MultiBoxControls.GeneralTextBox inNo = new MultiBoxControls.GeneralTextBox(); inNo.AAStyle = MultiBoxControls.GeneralTextBox.MBStyle.FmNumber; inNo.MaxLength = 5; inNo.Size = new System.Drawing.Size(45, 25); inNo.Location = new Point(iNoX, iY); inNo.Tag = i; inNo.TabIndex = i * 2; nNo.Add(inNo); nNo[i].Enter += new EventHandler(OSPCDepositForm_NoEnter); nNo[i].Leave += new EventHandler(OSPCDepositForm_NoLeave); panel2.Controls.Add(nNo[i]); MultiBoxControls.GeneralTextBox inCheq = new MultiBoxControls.GeneralTextBox(); inCheq.AAStyle = MultiBoxControls.GeneralTextBox.MBStyle.FmDollar; inCheq.MaxLength = 15; inCheq.Size = new System.Drawing.Size(100, 25); inCheq.Location = new Point(iCheqX, iY); inCheq.Tag = i; inCheq.TabIndex = i * 2 + 1; nCheq.Add(inCheq); nCheq[i].Enter += new EventHandler(OSPCDepositForm_CheqEnter); nCheq[i].Leave += new EventHandler(OSPCDepositForm_CheqLeave); panel2.Controls.Add(nCheq[i]); if (i < nMaxCash) { MultiBoxControls.GeneralTextBox inCash = new MultiBoxControls.GeneralTextBox(); inCash.MaxLength = 15; inCash.Size = new System.Drawing.Size(100, 25); inCash.Location = new Point(iCashX, iY); inCash.Tag = i; inCash.TabIndex = i + 20; if (i < nMaxCash - 1) { inCash.AAStyle = MultiBoxControls.GeneralTextBox.MBStyle.FmWon; } else { inCash.AAStyle = MultiBoxControls.GeneralTextBox.MBStyle.FmDollar; } nCash.Add(inCash); nCash[i].Enter += new EventHandler(OSPCDepositForm_CashEnter); nCash[i].Leave += new EventHandler(OSPCDepositForm_CashLeave); panel2.Controls.Add(nCash[i]); } iY += iJump; } myDB.CommandSQL = "SELECT ID, gubun, hang_code, mok FROM mok_title WHERE hang_code = ?"; myDB.Command.Parameters.Clear(); myDB.Command.Parameters.Add("hang_code", OleDbType.Integer).Value = nTrHangCode; mReader = myDB.ExeReader(); gridTotal.RowCount = 1; gridTotal["title", 0].Value = "TOTAL"; gridTotal["total", 0].Value = 0; gridTotal["title", 0].Style.BackColor = Color.Goldenrod; gridTotal["total", 0].Style.BackColor = Color.Goldenrod; int index = 1; while (mReader.Read()) { gridTotal.RowCount = index + 1; gridTotal["ID", index].Value = mReader["ID"]; gridTotal["title", index].Value = mReader["mok"]; gridTotal["total", index].Value = 0; gridTotal["selected", index].Value = false; gridTotal["title", index].Style.BackColor = Color.White; gridTotal["total", index++].Style.BackColor = Color.White; } mReader.Close(); ReloadTransaction(); }
private void OSPCDepositForm_NoEnter(object sender, EventArgs e) { MultiBoxControls.GeneralTextBox cn = (MultiBoxControls.GeneralTextBox)sender; mSaveText = cn.Value; }