Exemple #1
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            menuStrip1.BackColor = Color.LightGreen;

            if (ctrls != null)
            {
                ctrls.BeingModified = true;
                db.SaveChanges();
            }


            this.Text += " - Editing";
            editToolStripMenuItem.Enabled   = false;
            addNewToolStripMenuItem.Enabled = true;

            if (!string.IsNullOrWhiteSpace(controlsInfoStr))
            {
                ControlMoverOrResizer.SetSizeAndPositionOfControlsFromString(this, controlsInfoStr);
            }

            foreach (Control ctrl in Controls)
            {
                if (ctrl.GetType() == typeof(TextBox) || ctrl.GetType() == typeof(Button))
                {
                    ControlMoverOrResizer.Init(ctrl);
                }
            }
            controlsInfoStr = ControlMoverOrResizer.GetSizeAndPositionOfControlsToString(this);
        }
Exemple #2
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            controlsInfoStr = ControlMoverOrResizer.GetSizeAndPositionOfControlsToString(this);

            ctrls.Controls1     = controlsInfoStr;
            ctrls.BeingModified = false;
            db.SaveChanges();

            resetControls();
        }
Exemple #3
0
        // adding controls t othe form. TextBox and Button ctrls are avaialble
        private void addCtrl(String ctrlName, int posX = 100, int posY = 100, int width = 175, int height = 30)
        {
            dynamic ctrl = null;

            if (ctrlName.ToLower().StartsWith("textbox"))
            {
                ctrl           = new TextBox();
                ctrl.Multiline = true;
            }

            if (ctrlName.ToLower().StartsWith("button"))
            {
                ctrl = new Button();
            }

            ctrl.Name     = ctrlName;
            ctrl.Location = new Point(posX, posY);
            ctrl.Size     = new  Size(width, height);
            ctrl.Text     = ctrl.Name;

            Controls.Add(ctrl);
            controlsInfoStr = ControlMoverOrResizer.GetSizeAndPositionOfControlsToString(this);
        }