using Autodesk.Revit.DB; using Autodesk.Revit.DB.Plumbing; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace KMBIM.Revit.Tools.Cmd.DuctOffsetConnect { public partial class AngleSelect : System.Windows.Forms.Form { public double inputValue; public bool isConfirmed; public AngleSelect() { InitializeComponent(); } private void AngleSelect_Load(object sender, EventArgs e) { this.KeyPreview = true; txt_AngleInput.Text = "45"; btn_Confirm.Select(); } private void btn_Confirm_Click(object sender, EventArgs e) { isConfirmed = true; inputValue = double.Parse(txt_AngleInput.Text); Close(); } private void btn_Cancel_Click(object sender, EventArgs e) { isConfirmed = false; Close(); } //숫자와 백스페이스, 소숫점 말고 아예 입력 안되게 하기 private void txt_AngleInput_KeyPress(object sender, KeyPressEventArgs e) { if (!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back) || (e.KeyChar == '.'))) { e.Handled = true; } } private void txt_AngleInput_MouseClick(object sender, MouseEventArgs e) { txt_AngleInput.SelectAll(); } private void AngleSelect_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.DialogResult = DialogResult.Cancel; } else if (e.KeyCode == Keys.Enter) { this.DialogResult = DialogResult.OK; } } } }