Ejemplo n.º 1
0
        public void Add(Action action)
        {
            ActionRowControl container = new ActionRowControl()
            {
                Text = string.Empty, Width = this.Width, BackColor = Color.WhiteSmoke, BackColor2 = Color.WhiteSmoke, Action = action
            };
            CheckBox checkbox = new CheckBox()
            {
                Tag       = action,
                FlatStyle = System.Windows.Forms.FlatStyle.Flat,
                Dock      = DockStyle.Left,
                Text      = action.Name,
                ForeColor = Color.Gray,
                BackColor = Color.Transparent,
                Padding   = new Padding(25, 0, 0, 0),
                Width     = 200,
            };

            _tooltip.SetToolTip(checkbox, action.Description);
            container.Controls.Add(checkbox);

            Windows8LookNFeel.Windows8Button button = new Windows8LookNFeel.Windows8Button()
            {
                Left = container.Controls[0].Width + 4, Top = 2, Text = "Execute", Width = 55, Height = 20
            };
            button.Click += new EventHandler(button_Click);
            container.Controls.Add(button);

            StylingHeaderPanel progressPanel = new StylingHeaderPanel()
            {
                BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle, Visible = false, Top = 5, Left = container.Controls[1].Left + container.Controls[1].Width + 6, Text = string.Empty, Width = 120, Height = 14
            };

            container.Controls.Add(progressPanel);

            LinkLabel linkLabel = new LinkLabel()
            {
                Visible = false, Top = 2, Left = container.Controls[2].Left + container.Controls[2].Width + 4, Text = "Details", AutoSize = true
            };

            linkLabel.Click += new EventHandler(linkLabel_Click);
            linkLabel.Tag    = action;
            container.Controls.Add(linkLabel);

            action.HeaderPanel = container;

            action.Container = container;

            this.Controls.Add(container);
        }
Ejemplo n.º 2
0
        public void InitializeControls(Control container)
        {
            foreach (Control control in Helper.Instance.GetControlsRecursively(container))
            {
                if (control is TextBox)
                {
                    (control as TextBox).BorderStyle = BorderStyle.FixedSingle;
                    (control as TextBox).BackColor   = Color.WhiteSmoke;
                }

                else if (control.GetType().ToString() == typeof(Panel).ToString())
                {
                    if ((control as Panel).Tag == null)
                    {
                        if ((control as Panel).BackgroundImage == null)
                        {
                            (control as Panel).Paint += Background_Paint;
                        }
                    }
                }

                else if (control.GetType().ToString() == typeof(LinkLabel).ToString())
                {
                    if ((control as LinkLabel).Tag == null)
                    {
                        (control as LinkLabel).Font = new Font("Calibri", 8, FontStyle.Regular);
                    }
                }
                else if (control is DataGridView)
                {
                    DataGridView grid = control as DataGridView;

                    if (grid.Tag == null)
                    {
                        grid.BorderStyle     = BorderStyle.FixedSingle;
                        grid.ReadOnly        = true;
                        grid.GridColor       = Color.LightSteelBlue;
                        grid.BackgroundColor = Color.LightGray;
                        grid.SelectionMode   = DataGridViewSelectionMode.FullRowSelect;
                        grid.RowHeadersDefaultCellStyle.SelectionBackColor = Color.CornflowerBlue;
                        grid.RowsDefaultCellStyle.SelectionBackColor       = Color.CornflowerBlue;

                        grid.ColumnHeadersHeight         = 30;
                        grid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;

                        grid.RowsDefaultCellStyle.BackColor            = Color.FromArgb(230, 230, 230);
                        grid.AlternatingRowsDefaultCellStyle.BackColor = Color.White;

                        grid.RowTemplate.Height = 30;

                        grid.RowHeadersDefaultCellStyle.BackColor    = Color.WhiteSmoke;
                        grid.ColumnHeadersDefaultCellStyle.BackColor = Color.WhiteSmoke;
                        grid.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black;

                        grid.DataSourceChanged += new EventHandler(grid_DataSourceChanged);
                        grid_DataSourceChanged(grid, null);
                    }
                }

                else if (control is CheckedListBox)
                {
                    CheckedListBox cbx = control as CheckedListBox;

                    if (IsTagValid(cbx.Tag))
                    {
                        cbx.BorderStyle = BorderStyle.FixedSingle;

                        cbx.Font      = new Font("Segoe UI", 9);
                        cbx.ForeColor = Color.DarkBlue;
                    }

                    SetContextMenuStrip(cbx);
                }

                else if (control is ListBox)
                {
                    if ((control as ListBox).Tag == null)
                    {
                        (control as ListBox).BorderStyle = BorderStyle.FixedSingle;
                    }
                }

                else if (control is ComboBox)
                {
                    if ((control as ComboBox).Tag == null)
                    {
                        (control as ComboBox).FlatStyle = FlatStyle.Flat;
                    }
                }

                else if (control is Windows8LookNFeel.Windows8Button)
                {
                    Windows8LookNFeel.Windows8Button sbtn = control as Windows8LookNFeel.Windows8Button;

                    if (IsTagValid((control as Windows8LookNFeel.Windows8Button).Tag))
                    {
                        sbtn.BackColor  = Color.White;
                        sbtn.BackColor2 = Color.Silver;
                        sbtn.ForeColor  = Color.FromArgb(64, 64, 64);

                        sbtn.BackHighlightColor1 = Color.Green;
                        sbtn.BackHighlightColor2 = Color.Lime;
                    }
                }

                else if (control is StylingPanel)
                {
                    StylingPanel spnl = control as StylingPanel;

                    if (spnl.Tag == null)
                    {
                        spnl.BackColor  = Color.FromArgb(128, 128, 255);
                        spnl.BackColor2 = Color.Navy;
                    }
                }

                else if (control is PropertyGrid)
                {
                    if ((control as PropertyGrid).Tag == null)
                    {
                        (control as PropertyGrid).BackColor     = Color.WhiteSmoke;
                        (control as PropertyGrid).HelpBackColor = Color.WhiteSmoke;
                    }
                }

                else if (control is TreeView)
                {
                    if ((control as TreeView).Tag == null)
                    {
                        (control as TreeView).BorderStyle = BorderStyle.FixedSingle;
                    }
                }

                else if (control is CheckBox)
                {
                    if ((control as CheckBox).Tag == null)
                    {
                        (control as CheckBox).Font = new Font("Segoe UI", 9, FontStyle.Regular);
                    }
                }

                else if (control is RadioButton)
                {
                    if ((control as RadioButton).Tag == null)
                    {
                        (control as RadioButton).Font = new Font("Segoe UI", 9, FontStyle.Regular);
                    }
                }
            }
        }