private void FormProcCodeNew_Load(object sender, EventArgs e) { ProcedureCodes.RefreshCache(); listType.Items.Add(Lan.g(this, "none")); listType.Items.Add(Lan.g(this, "Exam")); listType.Items.Add(Lan.g(this, "Xray")); listType.Items.Add(Lan.g(this, "Prophy")); listType.Items.Add(Lan.g(this, "Fluoride")); listType.Items.Add(Lan.g(this, "Sealant")); listType.Items.Add(Lan.g(this, "Amalgam")); listType.Items.Add(Lan.g(this, "Composite, Anterior")); listType.Items.Add(Lan.g(this, "Composite, Posterior")); listType.Items.Add(Lan.g(this, "Buildup/Post")); listType.Items.Add(Lan.g(this, "Pulpotomy")); listType.Items.Add(Lan.g(this, "RCT")); listType.Items.Add(Lan.g(this, "SRP")); listType.Items.Add(Lan.g(this, "Denture")); listType.Items.Add(Lan.g(this, "RPD")); listType.Items.Add(Lan.g(this, "Denture Repair")); listType.Items.Add(Lan.g(this, "Reline")); listType.Items.Add(Lan.g(this, "Ceramic Inlay")); listType.Items.Add(Lan.g(this, "Metallic Inlay")); listType.Items.Add(Lan.g(this, "Whitening")); listType.Items.Add(Lan.g(this, "All-Ceramic Crown")); listType.Items.Add(Lan.g(this, "PFM Crown")); listType.Items.Add(Lan.g(this, "Full Gold Crown")); listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - Ceramic")); listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - PFM")); listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - Metal")); listType.Items.Add(Lan.g(this, "Extraction")); listType.Items.Add(Lan.g(this, "Ortho")); listType.Items.Add(Lan.g(this, "Nitrous")); if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { labelListType.Visible = false; listType.Visible = false; labelTreatArea.Visible = false; comboTreatArea.Visible = false; } listType.SelectedIndex = 0; for (int i = 0; i < Enum.GetNames(typeof(ToothPaintingType)).Length; i++) { comboPaintType.Items.Add(Enum.GetNames(typeof(ToothPaintingType))[i]); } comboPaintType.SelectedIndex = (int)ToothPaintingType.None; for (int i = 1; i < Enum.GetNames(typeof(TreatmentArea)).Length; i++) { comboTreatArea.Items.Add(Lan.g(this, Enum.GetNames(typeof(TreatmentArea))[i])); } comboTreatArea.SelectedIndex = (int)TreatmentArea.Mouth - 1; _listProcCodeCatDefs = Defs.GetDefsForCategory(DefCat.ProcCodeCats, true); for (int i = 0; i < _listProcCodeCatDefs.Count; i++) { comboCategory.Items.Add(_listProcCodeCatDefs[i].ItemName); } comboCategory.SelectedIndex = 0; textNewCode.Focus(); textNewCode.Select(textNewCode.Text.Length, 1); }
private void AddFood_Load(System.Object sender, System.EventArgs e) { frminptForm = new frmInputPanel(); LoadFoodOperandi(); LoadFoodTaste(); TextBox1.Select(0, TextBox1.Text.Length); rms_var.frmAddFood = this; GetFoodOperandis(); GetFoodTastes(); }
//<Snippet1> private void textBox1_Enter(object sender, System.EventArgs e) { // If the TextBox contains text, change its foreground and background colors. if (textBox1.Text != String.Empty) { textBox1.ForeColor = Color.Red; textBox1.BackColor = Color.Black; // Move the selection pointer to the end of the text of the control. textBox1.Select(textBox1.Text.Length, 0); } }
private void listBoxFiles_SelectedIndexChanged(object sender, System.EventArgs e) { string temp = textBoxFile.Text; enableTextChange = false; textBoxFile.Text = listBoxFiles.Text; if (listBoxFiles.Text.StartsWith(temp)) { textBoxFile.Select(temp.Length, textBoxFile.Text.Length - temp.Length); } }
private void FormProcCodeNew_Load(object sender, EventArgs e) { ProcedureCodes.Refresh(); listType.Items.Add(Lan.g(this, "none")); listType.Items.Add(Lan.g(this, "Exam")); listType.Items.Add(Lan.g(this, "Xray")); listType.Items.Add(Lan.g(this, "Prophy")); listType.Items.Add(Lan.g(this, "Fluoride")); listType.Items.Add(Lan.g(this, "Sealant")); listType.Items.Add(Lan.g(this, "Amalgam")); listType.Items.Add(Lan.g(this, "Composite, Anterior")); listType.Items.Add(Lan.g(this, "Composite, Posterior")); listType.Items.Add(Lan.g(this, "Buildup/Post")); listType.Items.Add(Lan.g(this, "Pulpotomy")); listType.Items.Add(Lan.g(this, "RCT")); listType.Items.Add(Lan.g(this, "SRP")); listType.Items.Add(Lan.g(this, "Denture")); listType.Items.Add(Lan.g(this, "RPD")); listType.Items.Add(Lan.g(this, "Denture Repair")); listType.Items.Add(Lan.g(this, "Reline")); listType.Items.Add(Lan.g(this, "Ceramic Inlay")); listType.Items.Add(Lan.g(this, "Metallic Inlay")); listType.Items.Add(Lan.g(this, "Whitening")); listType.Items.Add(Lan.g(this, "All-Ceramic Crown")); listType.Items.Add(Lan.g(this, "PFM Crown")); listType.Items.Add(Lan.g(this, "Full Gold Crown")); listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - Ceramic")); listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - PFM")); listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - Metal")); listType.Items.Add(Lan.g(this, "Extraction")); listType.Items.Add(Lan.g(this, "Ortho")); listType.Items.Add(Lan.g(this, "Nitrous")); listType.SelectedIndex = 0; for (int i = 0; i < Enum.GetNames(typeof(ToothPaintingType)).Length; i++) { comboPaintType.Items.Add(Enum.GetNames(typeof(ToothPaintingType))[i]); } comboPaintType.SelectedIndex = (int)ToothPaintingType.None; for (int i = 1; i < Enum.GetNames(typeof(TreatmentArea)).Length; i++) { comboTreatArea.Items.Add(Lan.g(this, Enum.GetNames(typeof(TreatmentArea))[i])); } comboTreatArea.SelectedIndex = (int)TreatmentArea.Mouth - 1; for (int i = 0; i < DefB.Short[(int)DefCat.ProcCodeCats].Length; i++) { comboCategory.Items.Add(DefB.Short[(int)DefCat.ProcCodeCats][i].ItemName); } comboCategory.SelectedIndex = 0; textNewCode.Focus(); textNewCode.Select(textNewCode.Text.Length, 1); }
private void HTTP_PORT_Validating(object sender, System.ComponentModel.CancelEventArgs e) { string errorMsg; if (!ValidPort(HTTP_PORT.Text, out errorMsg)) { // Cancel the event and select the text to be corrected by the user. e.Cancel = true; HTTP_PORT.Select(0, HTTP_PORT.Text.Length); // Set the ErrorProvider error with the text to display. this.Error.SetError(HTTP_PORT, errorMsg); } }
/// <summary> /// Handler for the "New" button. Clears form for creating a new /// employee. /// </summary> /// <param name="sender">Event sender, this form.</param> /// <param name="e">Event arguments - unused</param> private void buttonNew_Click(object sender, System.EventArgs e) { m_FirstName.Text = ""; m_MiddleName.Text = ""; m_LastName.Text = ""; m_Wage.Text = ""; m_SSN.Text = ""; radioSalaried.Checked = true; radioSalaried.Checked = true; dateTimePicker1.Value = DateTime.Today; m_comboEmp.SelectedIndex = -1; m_curEmployeeID = 0; m_FirstName.Select(); }
private void btnAdd_Click(object sender, EventArgs e) { var win = new Form(); var label = new Label {Text = "Node text (\f for format code):", AutoSize = true, Dock = DockStyle.Top}; var button = new Button {Text = "Add", Dock = DockStyle.Right}; var input = new TextBox {Dock = DockStyle.Bottom}; button.Click += (o, args) => { var selection = treeView.SelectedNode; var addition = Regex.Replace(input.Text, @"(?<!\\)\\f", "\f"); if(selection == null) { treeView.Nodes.Add(addition); } else { selection.Nodes.Add(addition); } win.Close(); }; win.Controls.Add(input); win.Controls.Add(button); win.Controls.Add(label); win.AcceptButton = button; win.Width = 300; win.Height = 72; win.Text = "Add Node"; win.ShowDialog(); input.Select(); }
private Clipboard_Dialog () { Text = AppMain.AppName + " - Clipboard" ; StartPosition = FormStartPosition.CenterParent ; FormBorderStyle = FormBorderStyle.FixedDialog ; ClientSize = new Size (400, 420) ; MaximizeBox = false ; MinimizeBox = false ; ControlBox = false ; ShowInTaskbar = false ; Edit = new TextBox () ; Edit.Parent = this ; Edit.Multiline = true ; Edit.WordWrap = true ; Edit.ScrollBars = ScrollBars.Both ; Edit.Location = new Point (10, 10) ; Edit.Size = new Size (380, 340) ; Edit.Text = Clipboard.GetText () ; Edit.Select (0,0) ; Button Apply = new Button () ; Apply.Parent = this ; Apply.Location = new Point (50, 360) ; Apply.Size = new Size (70, 20) ; Apply.Text = "Apply" ; Apply.Click += new EventHandler (OnApply) ; new OKButton (this) ; }
private void Projektsuche_Load(object sender, System.EventArgs e) { ProjectPath = PathMap.SubstitutePath("$(MD_PROJECTS)"); TextBoxSearch.Select(); return; }
private void InputDialog_Validating(object sender, System.ComponentModel.CancelEventArgs e) { InputText = ""; if (validateInput != null) { bool valid = true; string errorMessage = ""; try { valid = validateInput(textBox.Text, out errorMessage); } catch (Exception ex) { valid = false; errorMessage = ex.Message; } if (!valid) { // Cancel the event and select the text to be corrected by the user. e.Cancel = true; textBox.Select(0, textBox.Text.Length); // Set the ErrorProvider error with the text to display. errorProvider.SetError(textBox, errorMessage); return; } } InputText = textBox.Text; }
private void FormScheduleDayEdit_Load(object sender, System.EventArgs e) { DateTime time; for (int i = 0; i < 24; i++) { time = DateTime.Today + TimeSpan.FromHours(7) + TimeSpan.FromMinutes(30 * i); comboStart.Items.Add(time.ToShortTimeString()); comboStop.Items.Add(time.ToShortTimeString()); } comboStart.Text = SchedCur.StartTime.ToShortTimeString(); comboStop.Text = SchedCur.StopTime.ToShortTimeString(); textNote.Text = SchedCur.Note; if (SchedCur.StartTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay && SchedCur.StopTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay) { comboStop.Visible = false; comboStart.Visible = false; label1.Visible = false; label2.Visible = false; textNote.Select(); } else { comboStart.Select(); } }
private TextBox CreateNoteTextBox(TabPage tab) { Note note; if (checkedListBox1.SelectedIndex != -1) { note = (Note)checkedListBox1.SelectedItem; } else { note = new Note(); note.NoteDate = DateTime.Now; } var textBox = new System.Windows.Forms.TextBox(); textBox.Location = new System.Drawing.Point(18, 87); textBox.Multiline = true; textBox.Name = "textBox" + _tabIterator; textBox.Size = new System.Drawing.Size(891, 393); textBox.TabIndex = 1; textBox.Text = note.NoteBody; textBox.Select(0, 0); CreateNoteDateLabel(tab, note); return(textBox); }
private void FrmProjectsearch_Load(object sender, System.EventArgs e) { strProjects = PathMap.SubstitutePath("$(MD_PROJECTS)"); txtSearch.Select(); return; }
/// <summary> method _folderTreeView_BeforeSelect /// <para>Before we select a tree node we want to make sure that we scan the soon to be selected /// tree node for any sub-folders. this insures proper tree construction on the fly.</para> /// <param name="sender">The object that invoked this event</param> /// <param name="e">The TreeViewCancelEventArgs event arguments.</param> /// <see cref="System.Windows.Forms.TreeViewCancelEventArgs"/> /// <see cref="System.Windows.Forms.TreeView"/> /// </summary> private void _folderTreeView_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) { getSubDirs(e.Node); // get the sub-folders for the selected node. _pathTextBox.Text = fixPath(e.Node); // update the user selection text box. _pathTextBox.Select(_pathTextBox.Text.Length, 0); // Cursor at the end folder = new DirectoryInfo(e.Node.FullPath); // get it's Directory info. }
public ExceptionDialog(Exception ex, string sourceReason) { InitializeComponent(); //fill the text box ArrayList text = new ArrayList(); text.Add("Version: " + Application.ProductVersion); text.Add(sourceReason + "\r\n"); text.Add(ex.Message); text.Add(ex.StackTrace); text.Add(""); boxMessage.Lines = (string[])text.ToArray(typeof(string)); boxMessage.Select(boxMessage.Text.Length, 0); //use default email addresses boxFrom.Text = defaultFrom; boxEmailTo.Text = defaultTo; //save the message to disk string msg = ex.Message + "\r\n" + ex.Source + "\r\n" + ex.StackTrace + "\r\n\r\n"; if (ex.InnerException != null) { msg += ex.InnerException.Message + "\r\n" + ex.InnerException.Source + "\r\n" + ex.InnerException.StackTrace + "\r\n\r\n"; } Logger.Log(msg); }
private void TSize_Validating(object sender, System.ComponentModel.CancelEventArgs e) { string errorMsg = ""; // try { int val = Int32.Parse(TSize.Text); if (val <= 0) { errorMsg = "¡Debe especificar un tamaño válido!"; } } catch { errorMsg = "¡Debe especificar un tamaño válido!"; } // if (errorMsg != "") { // Cancel the event and select the text to be corrected by the user. e.Cancel = true; TSize.Select(0, TSize.Text.Length); // Set the ErrorProvider error with the text to display. this.errorProvider1.SetError(TSize, errorMsg); } }
public static string ShowTextDialog(string caption) { var prompt = new Form() { FormBorderStyle = FormBorderStyle.FixedDialog, MinimizeBox = false, MaximizeBox = false, Width = 200, Height = 110, Text = caption, StartPosition = FormStartPosition.CenterScreen, }; var cancel = new Button(); cancel.Click += (sender, e) => prompt.Close(); prompt.CancelButton = cancel; var textBox = new TextBox() { Left = 20, Top = 20, Width = 160, Height = 80, Text = "" }; var confirmation = new Button() { Text = "Ok", Left = 50, Top = 50, Width = 100, DialogResult = DialogResult.OK }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(textBox); prompt.Controls.Add(confirmation); prompt.AcceptButton = confirmation; textBox.Select(0, textBox.Text.Length); if (prompt.ShowDialog() == DialogResult.OK) { return textBox.Text; } return null; }
private static void scrollIntoViewAndHighlight(string text, Panel eclListing, System.Windows.Forms.Panel co, System.Windows.Forms.TextBox tb, int textStart) { eclListing.ScrollControlIntoView(co); tb.Select(textStart, text.Length); tb.HideSelection = false; return; }
} // end InitializeComponent #endregion #region DisplayResults /// <summary> /// Adds the text to the Finished Message Label and Summary Text to display the results to the user. /// </summary> public void DisplayResults() { _lblFinishedMsg.Text = _sResult; _txtSummary.Text = _sSummary; _txtSummary.Select(0, 0); // Called to ensure no text is selected when the user is shown the panel } // end DisplayResults
private void EditLabel_OnClick(object sender, EventArgs e) { if (edit) { System.Windows.Forms.TextBox TBTemp = new System.Windows.Forms.TextBox(); Label lb = (Label)sender; lb.Hide(); TBTemp.Location = lb.Location; TBTemp.Text = lb.Text; TBTemp.Font = lb.Font; TBTemp.Size = new Size(lb.Size.Width + 10, lb.Size.Height + 5); TBTemp.KeyDown += new System.Windows.Forms.KeyEventHandler(this.EditTextBox_Finish); TBTemp.LostFocus += new System.EventHandler(EditTextBox_LostFocus); TBTemp.Multiline = true; TBTemp.ScrollBars = ScrollBars.Vertical; int index = lb.Name.IndexOf("lb_"); string cleanName = (index < 0) ? lb.Name : lb.Name.Remove(index, 3); TBTemp.Name = cleanName; this.Controls.Add(TBTemp); TBTemp.Focus(); TBTemp.Select(TBTemp.Text.Length, 0); } }
public static void DisplayChanges() { string changes = string.Empty; using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames().First(e => e.ToLower().Contains("changes.txt")))) { using (StreamReader sr = new StreamReader(s)) { changes = sr.ReadToEnd(); } } Button b = new Button(); b.Text = "Close"; b.Dock = DockStyle.Bottom; b.Click += (src, evt) => { ((Form)b.Parent).Close(); }; TextBox tb = new TextBox(); tb.Text = changes; tb.Dock = DockStyle.Fill; tb.ReadOnly = true; tb.Multiline = true; tb.Select(0, 0); tb.ScrollBars = ScrollBars.Both; tb.WordWrap = true; Form f = new Form(); f.Size = new Size(400, 400); f.Text = "Changelog"; f.Controls.Add(tb); f.Controls.Add(b); f.ShowDialog(); }
public void SelectInvalid() { if (!IsValid) { txtClassInfo.Select(); txtClassInfo.SelectAll(); } }
private static bool Search(String search, TextBox target, bool forward) { if (forward) { int start = target.SelectionStart + target.SelectionLength; int i = target.Text.IndexOf(search, start, StringComparison.InvariantCultureIgnoreCase); if (i >= 0) { target.Select(i, search.Length); return true; } else { i = target.Text.IndexOf(search, 0, StringComparison.InvariantCultureIgnoreCase); if (i >= 0) { target.Select(i, search.Length); return true; } else return false; } } else { int start = target.SelectionStart; int i = target.Text.LastIndexOf(search, start, start + 1, StringComparison.InvariantCultureIgnoreCase); if (i >= 0) { target.Select(i, search.Length); return true; } else { i = target.Text.LastIndexOf(search, target.Text.Length - 1, target.Text.Length - start, StringComparison.InvariantCultureIgnoreCase); if (i >= 0) { target.Select(i, search.Length); return true; } else return false; } } }
public EditCommentsForm(string strCurrent) { // // Required for Windows Form Designer support // InitializeComponent(); textBox1.Text = strCurrent; textBox1.Select(0, 0); }
/// <summary> /// Position the carat at the end of the text to keep the last bit into view /// </summary> public static void PositionTextDisplay(TextBox box) { int length = box.Text.Length; if (Regex.IsMatch(box.Text, "(\r\n)$")) { length -= 2; } box.Select(length, 0); box.ScrollToCaret(); }
void FindNext(TextBox X,TextBox Y) { int vtbd = X.Text.IndexOf(X.SelectedText); //string chuoicl = ""; //if(vtbd-Y.TextLength>0) string chuoicl = X.Text.Remove(0, vtbd+ Y.TextLength); vtbd += chuoicl.IndexOf(Y.Text) + Y.TextLength; X.Select(vtbd, Y.TextLength); X.Focus(); }
bool ValidarPrecio(TextBox precio){ try { Double pre = Convert.ToDouble(precio.Text); return true; } catch { precio.Text = "0.0"; precio.Select(0, precio.Text.Length); return false; } }
/// <summary>Adds a line of text to the log.</summary> /// <param name="line">The text to add.</param> public void AddLine(string line) { try { txtLog.Text += line + Environment.NewLine; txtLog.Select(txtLog.Text.Length, 0); txtLog.ScrollToCaret(); } catch { // On the off chance that we put more than 32k in this log. } }
private void txtTimeOut_Leave(object sender, System.EventArgs e) { try { short TimeOut = Convert.ToInt16(txtTimeOut.Text); } catch { MessageBox.Show(this, "The time-out value must be a valid short", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTimeOut.Select(); } }
private void MoveCell(KeyEventArgs result) { string c = result.KeyData.ToString(); switch (c) { case "Left": if (CurrentColumn - 1 >= 0) { PerformCellMoveByRow(CurrentRow, CurrentColumn - 1); } break; case "Right": if (CurrentColumn + 1 < listView1.Columns.Count) { PerformCellMoveByRow(CurrentRow, CurrentColumn + 1); } break; case "Up": if (CurrentRow - 1 >= 0) { PerformCellMoveByRow(CurrentRow - 1, CurrentColumn); } break; case "Down": if (CurrentRow + 1 < listView1.Items.Count) { PerformCellMoveByRow(CurrentRow + 1, CurrentColumn); } break; default: // MessageBox.Show(result.KeyValue.ToString()); if (textBox1.Focused == false) { if (result.KeyValue >= (int)'A' && result.KeyValue <= (int)'Z') { if (result.Shift == false) { textBox1.Text = ((char)((int)c[0] - (int)'A' + (int)'a')).ToString(); } else { textBox1.Text = c; } } textBox1.Focus(); textBox1.Select(textBox1.Text.Length, 1); } break; } }
public static IStep createStepWithTextBox(string stepTitle, string message) { var textBox = new TextBox(); textBox.Multiline = true; textBox.ScrollBars = ScrollBars.Vertical; textBox.ReadOnly = true; textBox.Text = message; textBox.Select(0, 0); var newStep = new TemplateStep(textBox, 10, stepTitle); return newStep; }
public static void PeformTextboxKeyDown(KeyEventArgs e, System.Windows.Forms.TextBox _TxtPre, System.Windows.Forms.TextBox _TxtNext) { if (e.KeyCode == Keys.Up) { _TxtPre.Select(); } else if (e.KeyCode == Keys.Enter) { _TxtNext.Select(); } }
private void RequiresWindow() { _window = new Form(); var box = new TextBox(); box.Dock = DockStyle.Fill; _window.Controls.Add(box); _window.Show(); box.Select(); Application.DoEvents(); }
public static TextBox create_TextBox(string message) { var textBox = new TextBox(); textBox.Multiline = true; textBox.WordWrap = false; textBox.ScrollBars = ScrollBars.Both; textBox.ReadOnly = true; textBox.Text = message; textBox.Select(0, 0); return textBox; }
private int TextBoxParaInteiro(TextBox txt) { try { return Convert.ToInt32(txt.Text); } catch { txt.Focus(); txt.Select(); throw new Exception ("Número incorreto"); } }
private decimal TextBoxParaDecimal(TextBox txt) { try { return Convert.ToDecimal(txt.Text); } catch { txt.Focus(); txt.Select(); throw new Exception("Número incorreto"); } }
void FHierarchyViewerKeyPress(object sender, KeyPressEventArgs e) { FSearchTextBox.Focus(); if (e.KeyChar == (char)Keys.Back) { FSearchTextBox.Text = ""; } else { FSearchTextBox.Text += (e.KeyChar).ToString(); FSearchTextBox.Select(FSearchTextBox.Text.Length, 1); } }
public SimpleTextViewer(string FileName) { // // Required for Windows Form Designer support // InitializeComponent(); using (StreamReader theReader = new StreamReader(FileName)) textBox1.Text = theReader.ReadToEnd(); this.Text += " - " + FileName; textBox1.Select(0, 0); }
private void Updater_Load(object sender, System.EventArgs e) { if (File.Exists("New_unrar.dll")) { File.Copy("New_unrar.dll", "unrar.dll", true); File.Delete("New_unrar.dll"); } closeTimer.Stop(); if (UpdaterMain.UpdateVersion == null) { UpdateStatus("Checking latest version..."); try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://razor.uo.cx/version.txt"); req.UserAgent = "Razor Updater"; using (StreamReader reader = new StreamReader(req.GetResponse().GetResponseStream())) { UpdaterMain.UpdateVersion = new Version(reader.ReadToEnd().Trim()); } } catch { UpdateFailed(); return; } } _Downloader = new Downloader(String.Format("https://github.com/msturgill/razor/releases/download/v{0}/Update.rar", UpdaterMain.UpdateVersion.ToString()), "Update.rar", ChangelogRAR, new ProgressChange(OnProgressChange), new ConnectionFailed(OnConnectionFailed), new OperationComplete(OnDownloadComplete), new MessageDownloaded(OnChangelogDownloaded)); UpdateStatus("Downloading changelog..."); _Downloader.Download(); txtChangeLog.Text = "(Fetching Changelog...)"; txtChangeLog.Focus(); txtChangeLog.Select(0, 0); }
private DateTime TextBoxParaData(TextBox txt) { try { return Convert.ToDateTime(txt.Text); } catch { txt.Focus(); txt.Select(); throw new Exception ("Data inválida!"); } }
public ResumenFinal(string Mensaje) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // txtMensaje.Text = Mensaje; txtMensaje.Select(0, 0); }
public static bool ValidarCampoEntero(TextBox CajadeTexto) { try { decimal d = Convert.ToInt64(CajadeTexto.Text); return true; } catch (Exception ex) { CajadeTexto.Text = "0"; CajadeTexto.Select(0, CajadeTexto.Text.Length); return false; } }
public Form1(string d) { textBox_1 = new TextBox(); textBox_1.Select(0,0); //this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.TransparencyKey = Color.FromKnownColor(KnownColor.Control); this.Update(); InitializeComponent(); timer2.Enabled = true; //BackColor = Color.Transparent; dateTimePicker1.Value = Convert.ToDateTime( d); dateTimePicker2.Value = Convert.ToDateTime(dateTimePicker1.Value.AddDays(1)); typeof(TableLayoutPanel).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(tableLayoutPanel1, true, null); }
private void ConfigureInterface() { tbbAnterior.Enabled = !_uiController.IsFirstTask() && !_uiController.IsFlushedState(); tbbSeparator.Enabled = !_uiController.IsFirstTask() && !_uiController.IsFlushedState(); this.Text = _uiController.LeyendaFormulario; labelTarea.Text = _uiController.LeyendaFormulario; txtClaveAnt.Select(); txtClaveAnt.Enabled = _uiController.EnabledSetPreviuosPassword; mzCmbUsuarios.FillFromDataSource(_uiController.Usuarios, _uiController.KeyValueUsuarios, _uiController.KeyListUsuarios, 100, _uiController.KeyListUsuarios); mzCmbUsuarios.Enabled = !_uiController.EnabledSetPreviuosPassword; KeyPreview = true; }
public static bool validarCampoDecimal(TextBox CajadeTexto) { try { decimal d= Convert.ToDecimal(CajadeTexto.Text); return true; } catch( Exception ex) { CajadeTexto.Text ="0.0000"; CajadeTexto.Select(0,CajadeTexto.Text.Length); return false; } }
public void PrintText(string txt, TextBox printBox, Form owner) { if (printBox.InvokeRequired) { invokeTextBox d = new invokeTextBox(PrintText); owner.Invoke(d, txt, printBox, owner); } else { printBox.Text += txt; printBox.Select(printBox.Text.Length, 0); printBox.ScrollToCaret(); } }
public AuthenticationForm(string userName, string password, string title) { InitializeComponent(); textBox1.Text = userName; textBox2.Text = password; if (textBox1.Text != "") { textBox2.Select(); } if (title != null) { this.Text = title; } }
//int ir = 0; public SingleScheduler(string d) { //Thread thr = new Thread(new ThreadStart(splash)); //thr.Start(); //Thread.Sleep(5000); textBox_1 = new TextBox(); textBox_1.Select(0, 0); //this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.TransparencyKey = Color.FromKnownColor(KnownColor.Control); this.Update(); InitializeComponent(); timer1.Enabled = true; dateTimePicker1.Value = Convert.ToDateTime(d); //thr.Abort(); typeof(TableLayoutPanel).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(tableLayoutPanel1, true, null); }
public CustomTextbox(Action<string> callback, string placeHolder = null, int fontSize = 16) { this.callback = callback; customPlaceHolder = placeHolder; inputContainer = new BorderPanel(); inputContainer.Dock = DockStyle.Fill; input = new TextBox(); input.BorderStyle = BorderStyle.None; input.Font = new Font(CustomFonts.Fonts.Families[1], fontSize); input.HandleCreated += input_HandleCreated; input.KeyDown += input_KeyDown; inputContainer.BackColor = input.BackColor; inputContainer.Size = inputContainer.PreferredSize; inputContainer.GotFocus += (o, e) => input.Select(); inputContainer.Controls.Add(input); Controls.Add(inputContainer); Size = PreferredSize; }
private InputForm(string title, string caption, string defaultText) { Text = title; ShowIcon = false; ClientSize = new Size(280, 141); StartPosition = FormStartPosition.CenterScreen; FormBorderStyle = FormBorderStyle.FixedToolWindow; MaximizeBox = false; ControlBox = false; Label lblCaption = new Label(); lblCaption.Name = "lblCaption"; lblCaption.Location = new Point(12, 9); lblCaption.Text = caption; lblCaption.AutoSize = true; txtInput = new TextBox(); txtInput.Name = "txtInput"; txtInput.Location = new Point(15, 41); txtInput.Size = new Size(ClientSize.Width - (txtInput.Left * 2), 20); txtInput.Text = defaultText; txtInput.Select(txtInput.TextLength, 0); txtInput.Focus(); Button btnOK = new Button(); btnOK.Name = "btnOK"; btnOK.Size = new Size(75, 23); btnOK.Location = new Point(txtInput.Right - btnOK.Width, 70); btnOK.Text = "OK"; btnOK.Click += new EventHandler(btnOK_Click); ClientSize = new Size(ClientSize.Width, btnOK.Bottom + 15); AcceptButton = btnOK; Controls.Add(lblCaption); Controls.Add(txtInput); Controls.Add(btnOK); }
public static void Main() { TT(Console.WriteLine); var form = new Form(); var tb = new TextBox {Dock = DockStyle.Fill, Multiline = true}; form.Controls.Add(tb); form.Size = new System.Drawing.Size(800, 600); var text = ""; for (var i = 1; i <= MaxLetter; i++) { text += MakeTypized(i); text += MakeDecor(i); text += MakeSelectRule(i); text += MakeSelectWhereRule(i); } text += MakeSelectClauses(); text += MakeLogicExpressions(); text = MakeAll(text); text = MakeCopyright(text); tb.Text = text.Replace("\n", "\r\n"); tb.Select(0, text.Length*2); Application.Run(form); }
public TextEntryDialog () { groupBox1 = new GroupBox (); cancelButton = new Button (); iconPictureBox = new PictureBox (); newNameTextBox = new TextBox (); okButton = new Button (); label1 = new Label (); groupBox1.SuspendLayout (); SuspendLayout (); // groupBox1 groupBox1.Controls.Add (newNameTextBox); groupBox1.Controls.Add (label1); groupBox1.Controls.Add (iconPictureBox); groupBox1.Location = new Point (8, 8); groupBox1.Size = new Size (232, 160); groupBox1.TabIndex = 5; groupBox1.TabStop = false; groupBox1.Text = "New Name"; // cancelButton cancelButton.DialogResult = DialogResult.Cancel; cancelButton.Location = new Point (168, 176); cancelButton.TabIndex = 4; cancelButton.Text = "Cancel"; // iconPictureBox iconPictureBox.BorderStyle = BorderStyle.Fixed3D; iconPictureBox.Location = new Point (86, 24); iconPictureBox.Size = new Size (60, 60); iconPictureBox.TabIndex = 3; iconPictureBox.TabStop = false; iconPictureBox.SizeMode = PictureBoxSizeMode.CenterImage; // newNameTextBox newNameTextBox.Location = new Point (16, 128); newNameTextBox.Size = new Size (200, 20); newNameTextBox.TabIndex = 5; newNameTextBox.Text = String.Empty; // okButton okButton.DialogResult = DialogResult.OK; okButton.Location = new Point (80, 176); okButton.TabIndex = 3; okButton.Text = "OK"; // label1 label1.Location = new Point (16, 96); label1.Size = new Size (200, 23); label1.TabIndex = 4; label1.Text = "Enter Name:"; label1.TextAlign = ContentAlignment.MiddleCenter; // MainForm AcceptButton = okButton; AutoScaleBaseSize = new Size (5, 13); CancelButton = cancelButton; ClientSize = new Size (248, 205); Controls.Add (groupBox1); Controls.Add (cancelButton); Controls.Add (okButton); FormBorderStyle = FormBorderStyle.FixedDialog; Text = "New Folder or File"; groupBox1.ResumeLayout (false); ResumeLayout (false); newNameTextBox.Select (); }
private void CreateOneTextBox(int rowIndex, int columnIndex, string userSate, bool isRemoveIfCancel) { ListViewItem.ListViewSubItem subItem = this.Items[rowIndex].SubItems[columnIndex]; _tmpTextBox = new TextBox(); _tmpTextBox.Multiline = true; //只能使用标题框的宽度,使用item.SubItems[0]的宽度会有问题 _tmpTextBox.Bounds = new Rectangle(subItem.Bounds.Location, new Size(this.Columns[columnIndex].Width, subItem.Bounds.Height)); _tmpTextBox.Text = subItem.Text; _tmpTextBox.Tag = new string[] { rowIndex.ToString(), columnIndex.ToString(), userSate,isRemoveIfCancel.ToString()}; _tmpTextBox.KeyDown += tmpTextBox_KeyDown; _tmpTextBox.Leave += tmpTextBox_Leave; this.Controls.Add(_tmpTextBox); _tmpTextBox.BringToFront(); _tmpTextBox.Select(); }
/// <summary> /// Make a form /// </summary> public StrategyDescription() { PnlBase = new Panel(); PnlWarnBase = new FancyPanel(); LblWarning = new Label(); PnlTbxBase = new FancyPanel(Language.T("Strategy Description")); TxboxInfo = new TextBox(); BtnClose = new Button(); BtnAccept = new Button(); BtnClear = new Button(); AcceptButton = BtnClose; BackColor = LayoutColors.ColorFormBack; Icon = Data.Icon; MinimumSize = new Size(400, 400); Text = Language.T("Strategy Description"); FormClosing += ActionsFormClosing; Controls.Add(PnlBase); Controls.Add(BtnAccept); Controls.Add(BtnClose); Controls.Add(BtnClear); // PnlWarnBase PnlWarnBase.Parent = this; PnlWarnBase.Padding = new Padding(2, 4, 2, 2); // LblWarning LblWarning.Parent = PnlWarnBase; LblWarning.TextAlign = ContentAlignment.MiddleCenter; LblWarning.BackColor = Color.Transparent; LblWarning.ForeColor = LayoutColors.ColorControlText; LblWarning.AutoSize = false; LblWarning.Dock = DockStyle.Fill; if (Data.Strategy.Description != "") { if (!Data.IsStrDescriptionRelevant()) { LblWarning.Font = new Font(Font, FontStyle.Bold); LblWarning.Text = Language.T("This description might be outdated!"); } else LblWarning.Text = Path.GetFileNameWithoutExtension(Data.StrategyName); } else LblWarning.Text = Language.T("You can write a description of the strategy!"); PnlTbxBase.Parent = PnlBase; PnlTbxBase.Padding = new Padding(4, (int)PnlTbxBase.CaptionHeight + 1, 2, 3); PnlTbxBase.Dock = DockStyle.Fill; // TxboxInfo TxboxInfo.Parent = PnlTbxBase; TxboxInfo.Dock = DockStyle.Fill; TxboxInfo.BackColor = LayoutColors.ColorControlBack; TxboxInfo.ForeColor = LayoutColors.ColorControlText; TxboxInfo.BorderStyle = BorderStyle.None; TxboxInfo.Multiline = true; TxboxInfo.AcceptsReturn = true; TxboxInfo.AcceptsTab = true; TxboxInfo.ScrollBars = ScrollBars.Vertical; TxboxInfo.KeyDown += TxboxInfo_KeyDown; TxboxInfo.Text = Data.Strategy.Description; TxboxInfo.Select(0, 0); // BtnClose BtnClose.Text = Language.T("Close"); BtnClose.Click += BtnCloseClick; BtnClose.UseVisualStyleBackColor = true; // BtnAccept BtnAccept.Text = Language.T("Accept"); BtnAccept.Click += BtnAcceptClick; BtnAccept.UseVisualStyleBackColor = true; // BtnClear BtnClear.Text = Language.T("Clear"); BtnClear.Click += BtnClearClick; BtnClear.UseVisualStyleBackColor = true; _oldInfo = Data.Strategy.Description; }
//Button1.Click calls this //Background to black //Tab text to Instruction //Loop through all pages and add a label with the title text //Also sets the label in the middle and forecolor to red private void setTabPages() { tabControl1.SelectedIndex = 0; foreach (TabPage tab in tabControl1.TabPages) { tab.BackColor = Properties.Settings.Default.tabPageBackColor; } for (int i = 0; i < this.stringTwo.Length; i++) { TabPage tabpage = new TabPage("Statement") { BackColor = Properties.Settings.Default.tabPageBackColor, }; tabControl1.TabPages.Add(tabpage); } for (int i = 0; i < instruktioner + stringTwo.Length; i++) { TextBox text = new TextBox(); if(i >= instruktioner){ text.Text = this.stringTwo[i-instruktioner]; } else { text.Text = stringOne[i].Substring("Instruktioner".Length); } text.Size = new System.Drawing.Size(1000, 1000); text.Location = new Point(tabControl1.TabPages[0].Width / 2 - text.Width / 2, (tabControl1.TabPages[0].Height / 5 - text.Height)/3); text.ForeColor = Properties.Settings.Default.textColor; text.BackColor = Properties.Settings.Default.tabPageBackColor; text.Font = new Font("Microsoft Sans Serif", 40); text.WordWrap = true; text.ReadOnly = true; text.Multiline = true; text.Select(0, 0); text.BorderStyle = BorderStyle.None; text.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); tabControl1.TabPages[i].Controls.Add(text); tabControl1.TabPages[i].Focus(); } }
// check that textbox input is integer and within reasonable range private bool ValidateTextBoxValueIsUInt32(ref TextBox textBox, ref ErrorProvider e) { bool success = false; try { uint value = Convert.ToUInt32(textBox.Text); success = true; } catch (FormatException) { textBox.Select(0, textBox.Text.Length); e.SetError(textBox, "Invalid input value"); } catch (OverflowException) { textBox.Select(0, textBox.Text.Length); e.SetError(textBox, "Input value too large"); } return success; }
private void SetHotkeyHandlers(TextBox txtBox, Action<KeyOrButton> keySetCallback) { var oldText = txtBox.Text; txtBox.Text = "Set Hotkey..."; txtBox.Select(0, 0); KeyEventHandler handlerDown = null; KeyEventHandler handlerUp = null; EventHandler leaveHandler = null; EventHandlerT<GamepadButton> gamepadButtonPressed = null; Action unregisterEvents = () => { txtBox.KeyDown -= handlerDown; txtBox.KeyUp -= handlerUp; txtBox.Leave -= leaveHandler; Hook.AnyGamepadButtonPressed -= gamepadButtonPressed; }; handlerDown = (s, x) => { var key = x.KeyCode == Keys.Escape ? null : new KeyOrButton(x.KeyCode | x.Modifiers); if (x.KeyCode == Keys.ControlKey || x.KeyCode == Keys.ShiftKey || x.KeyCode == Keys.Menu) return; keySetCallback(key); unregisterEvents(); txtBox.Select(0, 0); chkGlobalHotkeys.Select(); txtBox.Text = FormatKey(key); }; handlerUp = (s, x) => { var key = x.KeyCode == Keys.Escape ? null : new KeyOrButton(x.KeyCode | x.Modifiers); if (x.KeyCode == Keys.ControlKey || x.KeyCode == Keys.ShiftKey || x.KeyCode == Keys.Menu) { keySetCallback(key); unregisterEvents(); txtBox.Select(0, 0); chkGlobalHotkeys.Select(); txtBox.Text = FormatKey(key); } }; leaveHandler = (s, x) => { unregisterEvents(); txtBox.Text = oldText; }; gamepadButtonPressed = (s, x) => { var key = new KeyOrButton(x); keySetCallback(key); unregisterEvents(); Action action = () => { txtBox.Select(0, 0); chkGlobalHotkeys.Select(); txtBox.Text = FormatKey(key); }; if (InvokeRequired) Invoke(action); else action(); }; txtBox.KeyDown += handlerDown; txtBox.KeyUp += handlerUp; txtBox.Leave += leaveHandler; Hook.AnyGamepadButtonPressed += gamepadButtonPressed; }
public static void DisableDecoration(TextBox box) { box.Margin = new Padding(0, 0, 0, 0); box.BorderStyle = BorderStyle.None; box.TextAlign = HorizontalAlignment.Center; box.Enabled = false; box.HideSelection = true; box.GotFocus += (a, b) => box.Select(0, 0); box.LostFocus += (a, b) => box.Select(0, 0); box.Leave += (a, b) => box.Select(0, 0); box.Click += (a, b) => box.Select(0, 0); }
/// <summary> /// Check whether the given TextBox contains a valid project name. If not, remove the /// invalid character and complain to the user. /// </summary> /// <param name="tb"></param> /// <returns>true if the project name does not contain any illegal characters</returns> public static bool CheckForValidProjectName(TextBox tb) { // Don't allow illegal characters. () and [] have significance. // [] are typically used as delimiters for file names in SQL queries. () are used in older // backup file names and as such, they can cause grief when trying to restore. Old example: // Jim's (old) backup (Jim_s (old) backup) ....zip. The file name was Jim_s (old) backup.mdf. string sIllegalChars = MiscUtils.GetInvalidProjectNameChars(MiscUtils.FilenameFilterStrength.kFilterProjName); char[] illegalChars = sIllegalChars.ToCharArray(); string sProjName = tb.Text; int illegalPos = sProjName.IndexOfAny(illegalChars); if (illegalPos < 0) return true; int selectionPos = illegalPos; while (illegalPos >= 0) { sProjName = sProjName.Remove(illegalPos, 1); selectionPos = illegalPos; illegalPos = sProjName.IndexOfAny(illegalChars); } // show the message // Remove characters that can not be keyboarded (below code point 32). The // user doesn't need to be warned about these since they can't be entered // via keyboard. string sIllegalCharsKeyboard = sIllegalChars; for (int n = 0; n < 32; n++) { int index = sIllegalCharsKeyboard.IndexOf((char)n); if (index >= 0) sIllegalCharsKeyboard = sIllegalCharsKeyboard.Remove(index, 1); } MessageBox.Show(null, String.Format(FwCoreDlgs.ksIllegalNameMsg, sIllegalCharsKeyboard), FwCoreDlgs.ksIllegalChars, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); tb.Text = sProjName; tb.Select(selectionPos, 0); return false; }