using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FPER { public partial class frmModalIdInputIO : Form { public frmModalIdInputIO() { InitializeComponent(); } //ÀԷ°ªÀ» ¹Þ°í, ³Ñ±â±âÀ§ÇÑ VO private InputIDVo inputVo; public InputIDVo InputVo { get { return this.inputVo; } set { this.inputVo = value; } } //È­¸éÀ̵¿À» À§ÇØ--------------- private Boolean MoveOK = true; private Point mouseOffset; //-------------------------------------------------------- // ¶óµð¿À¹öư ¼±Åðª int m_iSelected; /********************************************************/ /* MdiParent È­¸éÀ̵¿ */ /********************************************************/ private void frmIdInputIOModal_MouseDown(object sender, MouseEventArgs e) { try { if (MoveOK) { mouseOffset = new Point(-e.X, -e.Y); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void frmIdInputIOModal_MouseMove(object sender, MouseEventArgs e) { try { if (MoveOK && (e.Button == MouseButtons.Left)) { Point mousePos = Control.MousePosition; mousePos.Offset(mouseOffset.X, mouseOffset.Y); this.Location = mousePos; } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } /********************************************************/ private void btnClose_Click(object sender, EventArgs e) { try { this.inputVo.InputOK = false; this.Close(); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnOK_Click(object sender, EventArgs e) { try { inputVo.ReceiverID = (int)(num_ReceiverID.Value); inputVo.BoardID = (int)(num_CommBoardID.Value); inputVo.DeviceID = (int)(num_RepeaterID.Value); if (m_iSelected == 0) { inputVo.InoutType = code_InOutType.Input; } else { inputVo.InoutType = code_InOutType.Output; } /* this.inputVo.ReceiverID = Util.StrToInt(this.txtReceiverID.Text, inputVo.ReceiverID); this.inputVo.BoardID = Util.StrToInt(this.txtBoardID.Text, inputVo.BoardID); this.inputVo.DeviceID = Util.StrToInt(this.txtDeviceID.Text, inputVo.DeviceID); this.inputVo.InoutType = rdoInputType.Checked ? code_InOutType.Input : code_InOutType.Output; */ this.inputVo.InputOK = true; this.Close(); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void frmIdInputIOModal_Load(object sender, EventArgs e) { if (inputVo != null) { num_RepeaterID.Value = inputVo.RepeaterID; num_CommBoardID.Value = inputVo.BoardID; num_RepeaterID.Value = inputVo.DeviceID; if (inputVo.InoutType.Equals(code_InOutType.Input)) rdoInput.Checked = true; else rdoOutput.Checked = true; // ÀÌ°Ô ¿Ö ÀÖÀ»±î..?? /* if (inputVo.BoardID > 0) { num_CommBoardID.ReadOnly = true; num_CommBoardID.Enabled = false; } */ } /* try { if (inputVo != null) { txtReceiverID.Text = String.Format("{0:00}", inputVo.ReceiverID); txtBoardID.Text = String.Format("{0:00}", inputVo.BoardID); if (inputVo.InoutType.Equals(code_InOutType.Input)) rdoInputType.Checked = true; else rdoOutputType.Checked = true; if (inputVo.BoardID > 0) { txtBoardID.ReadOnly = true; btnBoardIDUp.Enabled = false; btnBoardIDDown.Enabled = false; } txtDeviceID.Text = String.Format("{0:00}", inputVo.DeviceID); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } */ } private void frmIdInputIOModal_Paint(object sender, PaintEventArgs e) { /* try { Graphics g = e.Graphics; Pen p = new Pen(Color.DarkGray, 3); Form gb = sender as Form; Rectangle rt = new Rectangle(gb.Location, gb.Size); g.DrawLine(p, 6, 0, 3, 0); g.DrawLine(p, 3, 0, 0, 6); g.DrawLine(p, 0, 6, 0, rt.Height - 4); g.DrawLine(p, 0, rt.Height - 4, 3, rt.Height - 1); g.DrawLine(p, 3, rt.Height - 1, rt.Width - 5, rt.Height - 1); g.DrawLine(p, rt.Width - 5, rt.Height - 1, rt.Width - 1, rt.Height - 5); g.DrawLine(p, rt.Width - 1, rt.Height - 5, rt.Width - 1, 6); g.DrawLine(p, rt.Width - 1, 6, rt.Width - 5, 0); g.DrawLine(p, rt.Width - 5, 0, 6, 0); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } */ } /* private void btnReceiverIDUp_Click(object sender, EventArgs e) { try { int val = Util.StrToInt(txtReceiverID.Text, 0); val++; txtReceiverID.Text = String.Format("{0:00}", val); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnReceiverIDDown_Click(object sender, EventArgs e) { try { int val = Util.StrToInt(txtReceiverID.Text, 0); val--; txtReceiverID.Text = String.Format("{0:00}", val); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnBoardIDUp_Click(object sender, EventArgs e) { try { int val = Util.StrToInt(txtBoardID.Text, 0); val++; txtBoardID.Text = String.Format("{0:00}", val); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnBoardIDDown_Click(object sender, EventArgs e) { try { int val = Util.StrToInt(txtBoardID.Text, 0); val--; if (val < 0) val = 0; txtBoardID.Text = String.Format("{0:00}", val); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnDeviceIDUp_Click(object sender, EventArgs e) { try { int val = Util.StrToInt(txtDeviceID.Text, 0); val++; //if (val > 8) val = 8; txtDeviceID.Text = String.Format("{0:00}", val); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnDeviceIDDown_Click(object sender, EventArgs e) { try { int val = Util.StrToInt(txtDeviceID.Text, 0); val--; if (val < 0) val = 0; txtDeviceID.Text = String.Format("{0:00}", val); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } */ private void rdoOutput_CheckedChanged(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; m_iSelected = int.Parse(rb.Tag.ToString()); } } }