123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- 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());
- }
- }
- }
|