public VNumberConst(decimal number) { this.number = number; BackColor = ColorSettings.Get("NumberConst"); lbl = new CustomLabel(number.ToString(), BackColor); lbl.Location = new Point(Const.TAB_SIZE / 2, Const.TAB_SIZE / 2); lbl.MouseDoubleClick += (sender, e) => { var newName = DiverseUtilExtensions.ShowDialog("Введите новое значение", "Новое значение"); newName = newName.Trim(); decimal result; if (newName.Length == 0 || !decimal.TryParse(newName, out result)) { return; } this.number = result; lbl.Text = this.number.ToString(); this.UpdateRecSize(); }; Controls.Add(lbl); UpdateSize(); }
public VStringConst(string str) { this.str = str; BackColor = ColorSettings.Get("StringConst"); lbl = new CustomLabel(str, BackColor); Controls.Add(lbl); UpdateSize(); lbl.Location = new Point(Const.TAB_SIZE / 2, Const.TAB_SIZE / 2); lbl.MouseDoubleClick += (sender, e) => { this.str = DiverseUtilExtensions.ShowDialog("Введите новое значение", "Новое значение"); lbl.Text = this.str; this.UpdateRecSize(); }; }
public VVariable(string name, VFunction parentFunc) : base(name, Color.Red) { varName = name; this.parentFunc = parentFunc; BackColor = ColorSettings.Get("Variable"); Size = new Size(20, 20); VariableRefs = new List <VVariableRef>(); MouseDoubleClick += (sender, e) => { var newName = DiverseUtilExtensions.ShowDialog("Введите имя переменной", "Переименование"); if (newName.Trim().Length == 0) { return; } varName = newName; Text = newName; foreach (var varRef in VariableRefs) { varRef.UpdateName(); } }; MouseClick += (sender, e) => { if (ModifierKeys == Keys.Control) { CreateVVariableRef(); } if (ModifierKeys == Keys.Shift) { parentFunc.RemoveArgument(this); } }; }