Пример #1
0
        private void дизайнФормыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            String         FormName = ((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl.FindForm().Name;
            FormUniqueForm ftd      = new FormUniqueForm(FormName);

            ftd.ShowDialog();
        }
Пример #2
0
        public static void pic(Control c)
        {
            //Фон формы FIXME!!!
            if (c.GetType().ToString().Contains("WindowsFormsApplication1"))
            {
                c.BackgroundImage  = DesignClass.FORM_BACKGROUND_IMG;
                c.Cursor           = DesignClass.FORM_CURSOR;
                c.BackColor        = DesignClass.FORM_COLOR;
                c.ContextMenuStrip = DesignClass.FORM_MENU;

                FormUniqueForm.GetFormDesignFromDb(ref c);
            }

            //Дизайн кнопок
            foreach (Control ctr in c.Controls)
            {
                #region DesignClass дефалт
                string ctr_type = ctr.GetType().ToString();
                if (ctr_type == "System.Windows.Forms.Button")
                {
                    ((Button)ctr).FlatStyle             = DesignClass.FLAT_OF_BUTTON;
                    ((Button)ctr).BackgroundImage       = DesignClass.BUTTON_BACKGROUND_IMG;
                    ((Button)ctr).BackgroundImageLayout = ImageLayout.Stretch;
                    ((Button)ctr).ForeColor             = DesignClass.BUTTON_TEXT_COLOR;
                    ((Button)ctr).TextAlign             = DesignClass.BUTTONIMAGE_ALLINE;
                    ((Button)ctr).Font      = DesignClass.BUTTON_FONT;
                    ((Button)ctr).BackColor = DesignClass.BUTTON_COLOR;
                    ctr.ContextMenuStrip    = DesignClass.BUTTON_MENU;
                }
                else if (ctr_type == "System.Windows.Forms.Label")
                {
                    ((Label)ctr).BackColor = Color.Transparent;
                    ((Label)ctr).ForeColor = DesignClass.LABEL_TEXT_COLOR;
                    ((Label)ctr).Font      = DesignClass.FONT_OF_LABEL;
                    if (!DesignClass.LABEL_AUTO_SIZE)
                    {
                        ((Label)ctr).TextAlign = DesignClass.LABEL_TEXT_ALIGN;
                    }
                    else
                    {
                        ((Label)ctr).AutoSize = true;
                    }
                    ctr.ContextMenuStrip = DesignClass.LABEL_MENU;
                }
                else if (ctr_type == "System.Windows.Forms.PictureBox")
                {
                    ctr.ContextMenuStrip = DesignClass.PICTURE_SAVE_MENU;
                }
                else if (ctr_type == "System.Windows.Forms.Panel")
                {
                    ((Panel)ctr).BackgroundImage = DesignClass.PANEL_BACKGROUND_IMG;
                    ((Panel)ctr).BackColor       = DesignClass.PANEL_COLOR;
                    ctr.ContextMenuStrip         = DesignClass.PANEL_MENU;
                    if (DesignClass.PANEL_TRANSPARENCY)
                    {
                        ((Panel)ctr).BackColor = Color.Transparent;
                    }
                }
                #endregion

                var temp = ButtonUniqueForm.GetUniqueDesignFromDB(ctr.Name);

                ctr.BackColor = temp.BackColor;
                ctr.ForeColor = temp.ForeColor;
                ctr.Font      = temp.Font;
                ctr.Visible   = temp.Visible;

                pic(ctr);
            }
        }