예제 #1
0
        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();
        }
예제 #2
0
        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();
            };
        }
예제 #3
0
        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);
                }
            };
        }