private void OnMouseUp(object sender, MouseEventArgs e) { if (sender is TextBox txt) { var frm = new frmNumpad(txt); frm.SetLocation(txt.Right, txt.Top); frm.FormClosed += (s, ea) => { var dto = new PrinterInfoDto(); if (!String.IsNullOrEmpty(txtPrinterSpeed.Text)) { if (Int32.TryParse(txtPrinterSpeed.Text, out var i)) { dto.PrinterConveyorSpeed = i; } } if (!String.IsNullOrEmpty(txtInfeedSpeed.Text)) { if (Int32.TryParse(txtInfeedSpeed.Text, out var j)) { dto.InfeedSpeed = j; } } _pviController.SetVariables(dto); }; frm.Show(); } }
private void btnSavePassword_Click(object sender, EventArgs e) { if (sender is Button b) { if (b.Text.Contains("Select")) { var frm = new frmNumpad(txtPassword) { StartPosition = FormStartPosition.CenterParent }; frm.ShowDialog(this); b.Text = "Save Password"; } else { if (txtPassword.Text.Length > 0) { ControlWorks.UI.BarTender.Properties.Settings.Default.Password = txtPassword.Text; ControlWorks.UI.BarTender.Properties.Settings.Default.Save(); MessageBox.Show($"Password changed to {txtPassword.Text}", "Password Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); } b.Text = "Select Password"; txtPassword.Text = String.Empty; } } }
private void OnMouseUp(object sender, MouseEventArgs e) { if (sender is TextBox txt) { var frm = new frmNumpad(txt); frm.SetLocation(txt.Right, txt.Top); frm.FormClosed += (s, ea) => { SetCurrentBox(); SetLableDistance(); }; frm.Show(); } }
private void OnMouseUp(object sender, MouseEventArgs e) { if (sender is TextBox txt) { var frm = new frmNumpad(txt) { MaxValue = 100.00M }; frm.SetLocation(txt.Right, txt.Top); Point location = txt.PointToScreen(Point.Empty); var x = location.X - frm.Width / 2; var y = location.Y + 30; frm.Location = new Point(x, y); frm.Show(); } }