private void btnAnimRename_Click(object sender, EventArgs e) { //Rename anim TextInputForm form = new TextInputForm("New Animation Name:", "Rename Animation"); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { KartAnimationSeries existingAnim = Kart.Kart.KartAnimations.SingleOrDefault(k => k.Name == form.TextOutput); if (existingAnim == SelectedAnimation) { return; } if (existingAnim != null) { MessageBox.Show("Animation with the given name already exists! Please use a unique name!", "Warning"); return; } Kart.RenameAnimation(SelectedAnimation, form.TextOutput); PopulateAnimations(); //PopulateAnimationImages(); //UpdateKartPreviewAnimation(); //UpdateAnimationEnableds(); } }
/// <summary> /// 获取输入文本 /// </summary> /// <param name="text"></param> /// <param name="initEnm"></param> /// <param name="formTitle"></param> /// <returns></returns> public static bool ShowTextInputForm(out string text, string initEnm = null, string formTitle = "请输入") { text = ""; TextInputForm form = new TextInputForm(initEnm); form.Text = formTitle; if (form.ShowDialog() == DialogResult.OK) { text = form.TextValue; return(true); } return(false); }
public string GetName() { TextInputForm input = new TextInputForm(); DialogResult diag = input.ShowDialog(); if (diag == DialogResult.OK) { return(input.outputText); } else { return("Nespecifikované"); } }
private bool ShowTextInput(bool isNew) { TextInputForm textInput = new TextInputForm(); if (!isNew) { textInput.UpdateFromLabel(childLabel); } textInput.InputText.ForeColor = childLabel.ForeColor; if (textInput.ShowDialog(parent) == DialogResult.OK && textInput.InputText.Text.Length > 0) { childLabel.Text = textInput.InputText.Text; childLabel.Font = textInput.InputText.Font; ForeColor = textInput.InputText.ForeColor; parent.Invalidate(); return(true); } return(false); }
public TextBox2(Control parent, string text, Vector2 location, Vector2 size) { Parent = parent; Size = size; LocalLocation = location; Text = text; Clicked += (s, e) => { var form = new TextInputForm("", MaxLength, true); form.InputText = Text; var res = form.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { Text = form.InputText; TextChanged(this, EventArgs.Empty); } }; }
private void newKartToolStripMenuItem_Click(object sender, EventArgs e) { //CheckIfNeedToSave(); //kartName = RequestKartName(); //ChompShopFloor.NewKart(kartName); TextInputForm form = new TextInputForm("Kart Name:", "New Kart Name"); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //Later on, do better name verifcation if (string.IsNullOrWhiteSpace(form.TextOutput)) { MessageBox.Show("Kart Name is invalid!"); } else { ChompShopFloor.NewKart(form.TextOutput); } } }
private bool ShowTextInput(bool isNew) { TextInputForm textInput = new TextInputForm(); if (!isNew) { textInput.UpdateFromLabel(childLabel); } textInput.InputText.ForeColor = childLabel.ForeColor; textInput.ShowDialog(parent); if (textInput.DialogResult == DialogResult.Cancel) { return(false); } string text = textInput.InputText.Text; childLabel.Text = textInput.InputText.Text; childLabel.Font = textInput.InputText.Font; ForeColor = textInput.InputText.ForeColor; parent.Invalidate(); return(true); }
private bool ShowTextInput(bool isNew) { TextInputForm textInput = new TextInputForm(); if (!isNew) { textInput.UpdateFromLabel(childLabel); } textInput.InputText.ForeColor = childLabel.ForeColor; if (textInput.ShowDialog(parent) == DialogResult.OK && textInput.InputText.Text.Length > 0) { childLabel.Text = textInput.InputText.Text; childLabel.Font = textInput.InputText.Font; ForeColor = textInput.InputText.ForeColor; parent.Invalidate(); return true; } return false; }