using DevComponents.DotNetBar.Controls; using DevComponents.DotNetBar.Keyboard; using POSV.Entity; using POSV.Utils; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Globalization; using System.Linq; using System.Text; using System.Windows.Forms; namespace POSV.WaiMai { public partial class VisitorEditForm : BusinessForm { public Visitor _visitor = null; public VisitorAddress _visitorAddress = null; public bool Save = false; public VisitorEditForm() { InitializeComponent(); } private void VisitorEditForm_Load(object sender, EventArgs e) { txtname.Text = _visitorAddress.Name;//姓名 numericTextBox1.Text = _visitor.Title;//称谓 numericTextBox2.Text = _visitorAddress.Telephone;//来电号码 numericTextBox3.Text = _visitor.Position;//职位 numericTextBox4.Text = _visitorAddress.Address;//地址 checkBoxX7.Checked = _visitor.Sex.Equals(1); } private void buttonX1_Click(object sender, EventArgs e) { _visitorAddress.Name = txtname.Text ;//姓名 _visitor.Title = numericTextBox1.Text;//称谓 _visitorAddress.Telephone = numericTextBox2.Text;//来电号码 _visitor.Position = numericTextBox3.Text;//职位 _visitorAddress.Address = numericTextBox4.Text;//地址 _visitor.Sex = checkBoxX7.Checked ? 1 : 0; Save = true; this.Close(); } private void controlBox_CloseClick(object sender, EventArgs e) { if (this.Owner != null) { this.Owner.Close(); } this.Close(); } private void buttonX4_Click(object sender, EventArgs e) { if (this.Owner != null) { this.Owner.Close(); } this.Close(); } private void lblInputLanguage_Click(object sender, EventArgs e) { InputSimulatorUtils.SendCtrlShift(); } private Keyboard CreateNumericKeyboard() { Keyboard keyboard = new Keyboard(); LinearKeyboardLayout layout = new LinearKeyboardLayout(); layout.AddKey("7"); layout.AddKey("8"); layout.AddKey("9"); //layout.AddKey("+" , "{ADD}" , height: 21); layout.AddKey("Backspace", "{BACKSPACE}", height: 21); layout.AddLine(); layout.AddKey("4"); layout.AddKey("5"); layout.AddKey("6"); layout.AddLine(); layout.AddKey("1"); layout.AddKey("2"); layout.AddKey("3"); layout.AddKey("Enter", "{ENTER}", height: 21); layout.AddLine(); layout.AddKey("0", width: 21); layout.AddKey("."); keyboard.Layouts.Add(layout); return keyboard; } private void chkChinese_CheckedChanged(object sender, EventArgs e) { var item = sender as CheckBoxX; if (item.Checked) { KeyboardType type = KeyboardType.中文; Enum.TryParse(item.Tag.ToString(), out type); switch (type) { case KeyboardType.中文: { this.lblInputLanguage.Visible = true; var lang = InputLanguage.FromCulture(CultureInfo.GetCultureInfo("zh-CN")); InputLanguage.CurrentInputLanguage = lang; this.keyboardControl.Keyboard = Keyboard.CreateDefaultKeyboard(); } break; case KeyboardType.英文: { this.lblInputLanguage.Visible = false; var lang = InputLanguage.FromCulture(CultureInfo.GetCultureInfo("en-US")); InputLanguage.CurrentInputLanguage = lang; this.keyboardControl.Keyboard = Keyboard.CreateDefaultKeyboard(); } break; case KeyboardType.数字: { this.lblInputLanguage.Visible = false; this.keyboardControl.Keyboard = CreateNumericKeyboard(); } break; } } this.keyboardControl.Invalidate(); } } }