private void createDateTimeControls() { MobileTextBox day = (MobileTextBox)MainProcess.CreateTextBox(50, 150, 25, string.Empty, ControlsStyle.LabelLarge, false); MobileControl dot1 = MainProcess.CreateLabel(".", 80, 150, 5, MobileFontSize.Large, FontStyle.Bold); MobileControl month = MainProcess.CreateTextBox(90, 150, 25, string.Empty, ControlsStyle.LabelLarge, false); MobileControl dot2 = MainProcess.CreateLabel(".", 120, 150, 5, MobileFontSize.Large, FontStyle.Bold); MobileControl year = MainProcess.CreateTextBox(130, 150, 50, string.Empty, ControlsStyle.LabelLarge, false); day.Focus(); //сохранить нужно как: MM-dd-yyyy, а отображать: dd-MM-yyyy controls.Add(month); controls.Add(dot1); controls.Add(day); controls.Add(dot2); controls.Add(year); TextBox dayBox = (TextBox)day.GetControl(); TextBox monthBox = (TextBox)month.GetControl(); TextBox yearBox = (TextBox)year.GetControl(); //dayBox.MaxLength = 2; dayBox.TextChanged += ValueEditor_TextChanged; //monthBox.MaxLength = 2; monthBox.TextChanged += ValueEditor_TextChanged2; //yearBox.MaxLength = 2; yearBox.TextChanged += ValueEditor_TextChanged3; }
/// <summary></summary> private void hideTextBox() { if (registerTextBox != null) { registerLabel.Show(); if (string.IsNullOrEmpty(registerTextBox.Text)) { clearRegister(); } else { int registerValue; try { registerValue = int.Parse(registerTextBox.Text); } catch (FormatException) { registerTextBox.Text = string.Empty; registerValue = 0; } if (registerValue >= MapInfo.Range.X && registerValue <= MapInfo.Range.Y) { registerLabel.Text = registerTextBox.Text; registerLabel.SetControlsStyle(ControlsStyle.LabelNormal); } else { ShowMessage(string.Format("Допустимый диапазон значений:\r\n{0}-{1}", MapInfo.Range.X, MapInfo.Range.Y)); } } MainProcess.RemoveControl((Control)registerTextBox.GetControl()); registerTextBox = null; } }