diff --git a/unimarc/unimarc/Main.cs b/unimarc/unimarc/Main.cs index 705a18c..309b6f4 100644 --- a/unimarc/unimarc/Main.cs +++ b/unimarc/unimarc/Main.cs @@ -871,19 +871,6 @@ namespace WindowsFormsApp1 return form; } - private void FocusTabFor(Form form) - { - foreach (TabPage tb in mdiTabControl.TabPages) - { - if (tb.Tag == form) - { - mdiTabControl.SelectedTab = tb; - form.Focus(); - return; - } - } - } - private void menu_allclose_Click(object sender, EventArgs e) { // Create a copy of the list since closing forms modifies the collection diff --git a/unimarc/unimarc/납품관리/List_aggregation.cs b/unimarc/unimarc/납품관리/List_aggregation.cs index 8453c07..f62045e 100644 --- a/unimarc/unimarc/납품관리/List_aggregation.cs +++ b/unimarc/unimarc/납품관리/List_aggregation.cs @@ -583,13 +583,10 @@ namespace WindowsFormsApp1.Delivery if (e.ColumnIndex != 2 || e.ColumnIndex != 4 || e.ColumnIndex != 5 || e.ColumnIndex != 6 || e.ColumnIndex != 15) { - List_Lookup list_l = new List_Lookup(this) + var list_l = main.OpenFormInTab(() => new List_Lookup(this) { call_base = dataGridView1.Rows[e.RowIndex].Cells["list_name"].Value.ToString() - }; - list_l.MdiParent = main; - list_l.WindowState = FormWindowState.Maximized; - list_l.Show(); + }); } } private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) diff --git a/unimarc/unimarc/마크/Mac_List.cs b/unimarc/unimarc/마크/Mac_List.cs index 5c67520..fb8fee9 100644 --- a/unimarc/unimarc/마크/Mac_List.cs +++ b/unimarc/unimarc/마크/Mac_List.cs @@ -355,25 +355,14 @@ namespace WindowsFormsApp1.Mac Skill_Grid sg = new Skill_Grid(); sg.Print_Grid_Num(sender, e); } - private Check_ISBN mMac_check_ISBN; + private void btnSearchISBN_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows[0].Index < 0) return; string tSearchText = dataGridView1.SelectedRows[0].Cells["list_name"].Value.ToString(); string tSearchIDX = dataGridView1.SelectedRows[0].Cells["idx"].Value.ToString(); - if (mMac_check_ISBN != null) - { - mMac_check_ISBN.Focus(); - } - else - { - mMac_check_ISBN = new Check_ISBN(main, tSearchText, tSearchIDX); - mMac_check_ISBN.MdiParent = main; - mMac_check_ISBN.WindowState = FormWindowState.Maximized; - mMac_check_ISBN.FormClosed += (o, ea) => mMac_check_ISBN = null; - mMac_check_ISBN.tb_list_name.Enabled = true; - mMac_check_ISBN.Show(); - } + var isbn = main.OpenFormInTab(() => new Check_ISBN(main, tSearchText, tSearchIDX)); + isbn.tb_list_name.Enabled = true; } } } diff --git a/unimarc/unimarc/회계/Purchase_Aggregation.cs b/unimarc/unimarc/회계/Purchase_Aggregation.cs index b2f1cc8..e870570 100644 --- a/unimarc/unimarc/회계/Purchase_Aggregation.cs +++ b/unimarc/unimarc/회계/Purchase_Aggregation.cs @@ -173,7 +173,8 @@ namespace WindowsFormsApp1.Account buy = Convert.ToInt32(dataGridView1.Rows[idx].Cells[4].Value.ToString()); } int pay = 0; - if (dataGridView1.Rows[idx].Cells[5].Value.ToString() != "0") { + if (dataGridView1.Rows[idx].Cells[5].Value.ToString() != "0") + { pay = Convert.ToInt32(dataGridView1.Rows[idx].Cells[5].Value.ToString()); } @@ -273,13 +274,10 @@ namespace WindowsFormsApp1.Account // 일자별이나 전체에선 더블클릭 이벤트 활성화 되지않음. if(radioButton1.Checked == true || radioButton4.Checked == true) { return; } - Purchase_Book pb = new Purchase_Book(this); - pb.MdiParent = main; - pb.WindowState = FormWindowState.Maximized; + var pb = main.OpenFormInTab(() => new Purchase_Book(this)); pb.tb_purchase.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); pb.start_Date.Value = DateTime.Parse(start_date.Value.ToString()); pb.end_Date.Value = DateTime.Parse(end_date.Value.ToString()); - pb.Show(); pb.btn_Lookup_Click(null, null); } diff --git a/unimarc/unimarc/회계/Sales_Book.cs b/unimarc/unimarc/회계/Sales_Book.cs index 5da3097..e95dca3 100644 --- a/unimarc/unimarc/회계/Sales_Book.cs +++ b/unimarc/unimarc/회계/Sales_Book.cs @@ -18,11 +18,12 @@ namespace WindowsFormsApp1.회계 Helper_DB db = new Helper_DB(); public string compidx; public int row = -1; - public Sales_Book(Sales_Deposit _sd) + public Sales_Book(Sales_Deposit _sd, Main _main) { InitializeComponent(); sd = _sd; compidx = sd.compidx; + main = _main; } public Sales_Book(Main _main) { @@ -200,16 +201,13 @@ namespace WindowsFormsApp1.회계 dataGridView1.Rows[row].Cells["content"].Value.ToString() == "입금 카드" || dataGridView1.Rows[row].Cells["content"].Value.ToString() == "입금 현금" || dataGridView1.Rows[row].Cells["content"].Value.ToString() == "입금 어음") { return; } - Sales_Detail sde = new Sales_Detail(this); + var sde = main.OpenFormInTab(() => new Sales_Detail(this)); string out_date = dataGridView1.Rows[e.RowIndex].Cells["out_date"].Value.ToString().Substring(0, 10).Replace("-", ""); int yesr = Convert.ToInt32(out_date.Substring(0, 4)); int month = Convert.ToInt32(out_date.Substring(4, 2)); int day = Convert.ToInt32(out_date.Substring(6, 2)); - sde.MdiParent = this.MdiParent; - sde.WindowState = FormWindowState.Maximized; sde.Out_Date.Value = new DateTime(yesr, month, day); sde.tb_clt.Text = tb_clt.Text; - sde.Show(); } } } diff --git a/unimarc/unimarc/회계/Sales_Deposit.cs b/unimarc/unimarc/회계/Sales_Deposit.cs index 8297624..7af8801 100644 --- a/unimarc/unimarc/회계/Sales_Deposit.cs +++ b/unimarc/unimarc/회계/Sales_Deposit.cs @@ -288,14 +288,11 @@ namespace WindowsFormsApp1.Account { if (rb_Date.Checked) return; if (e.RowIndex < 0) { return; } - Sales_Book sb = new Sales_Book(this); + var sb = main.OpenFormInTab(() => new Sales_Book(this, main)); sb.row = e.RowIndex; - sb.MdiParent = main; - sb.WindowState = FormWindowState.Maximized; sb.tb_clt.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); sb.Start_Date.Value = DateTime.Parse(Start_Date.Value.ToString()); sb.End_Date.Value = DateTime.Parse(End_Date.Value.ToString()); - sb.Show(); sb.btn_Lookup_Click(null, null); } } diff --git a/unimarc/unimarc/회계/Sales_Lookup.cs b/unimarc/unimarc/회계/Sales_Lookup.cs index 5f7ea5d..efb6394 100644 --- a/unimarc/unimarc/회계/Sales_Lookup.cs +++ b/unimarc/unimarc/회계/Sales_Lookup.cs @@ -166,16 +166,15 @@ namespace WindowsFormsApp1.Account } private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - Sales_Detail sd = new Sales_Detail(this); string out_date = dataGridView1.Rows[e.RowIndex].Cells["out_date"].Value.ToString().Substring(0, 10).Replace("-", ""); int yesr = Convert.ToInt32(out_date.Substring(0, 4)); int month = Convert.ToInt32(out_date.Substring(4, 2)); int day = Convert.ToInt32(out_date.Substring(6, 2)); - sd.MdiParent = main; - sd.WindowState = FormWindowState.Maximized; + + var sd = main.OpenFormInTab(() => new Sales_Detail(this)); sd.Out_Date.Value = new DateTime(yesr, month, day); sd.tb_clt.Text = dataGridView1.Rows[e.RowIndex].Cells["clt"].Value.ToString(); - sd.Show(); + } } }