private void SetLayout() { if (isMin6 && Application.RenderWithVisualStyles) { using (var g = CreateGraphics()) { // Back button var theme = new VisualStyleRenderer(VisualStyleElementEx.Navigation.BackButton.Normal); var bbSize = theme.GetPartSize(g, ThemeSizeType.Draw); // Title theme.SetParameters(VisualStyleElementEx.AeroWizard.TitleBar.Active); title.Font = theme.GetFont2(g); titleBar.Height = Math.Max(theme.GetMargins2(g, MarginProperty.ContentMargins).Top, bbSize.Height + 2); titleBar.ColumnStyles[0].Width = bbSize.Width + 4F; titleBar.ColumnStyles[1].Width = titleImageIcon != null ? titleImageList.ImageSize.Width + 4F : 0; backButton.Size = bbSize; // Header theme.SetParameters(VisualStyleElementEx.AeroWizard.HeaderArea.Normal); headerLabel.Font = theme.GetFont2(g); headerLabel.Margin = theme.GetMargins2(g, MarginProperty.ContentMargins); headerLabel.ForeColor = theme.GetColor(ColorProperty.TextColor); // Content theme.SetParameters(VisualStyleElementEx.AeroWizard.ContentArea.Normal); BackColor = theme.GetColor(ColorProperty.FillColor); contentArea.Font = theme.GetFont2(g); var cp = theme.GetMargins2(g, MarginProperty.ContentMargins); contentArea.ColumnStyles[0].Width = cp.Left; contentArea.RowStyles[1].Height = cp.Bottom; // Command theme.SetParameters(VisualStyleElementEx.AeroWizard.CommandArea.Normal); cp = theme.GetMargins2(g, MarginProperty.ContentMargins); commandArea.RowStyles[0].Height = cp.Top; commandArea.RowStyles[2].Height = cp.Bottom; commandArea.ColumnStyles[1].Width = contentArea.ColumnStyles[contentCol + 1].Width = cp.Right; commandAreaBorder.Height = 0; theme.SetParameters(VisualStyleElementEx.AeroWizard.Button.Normal); var btnHeight = theme.GetInteger(IntegerProperty.Height); commandAreaButtonFlowLayout.MinimumSize = new Size(0, btnHeight); var btnFont = theme.GetFont2(g); foreach (Control ctrl in commandAreaButtonFlowLayout.Controls) { ctrl.Font = btnFont; ctrl.Height = btnHeight; //ctrl.MaximumSize = new Size(0, btnHeight); } themePropsSet = true; } } else { commandAreaBorder.Height = 1; backButton.Size = new Size(GetUnthemedBackButtonImage().Width, GetUnthemedBackButtonImage().Height / 4); BackColor = UseAeroStyle ? SystemColors.Window : SystemColors.Control; } }
private void SetLayout() { if (isMin6 && Application.RenderWithVisualStyles) { VisualStyleRenderer theme; using (Graphics g = this.CreateGraphics()) { // Back button theme = new VisualStyleRenderer(VisualStyleElementEx.Navigation.BackButton.Normal); Size bbSize = theme.GetPartSize(g, ThemeSizeType.Draw); // Title theme.SetParameters(VisualStyleElementEx.AeroWizard.TitleBar.Active); titleBar.Height = 32; //Math.Max(theme.GetMargins2(g, MarginProperty.ContentMargins).Top, bbSize.Height + 2); titleBar.ColumnStyles[0].Width = bbSize.Width + 4f; titleBar.ColumnStyles[1].Width = 1; // titleImageIcon != null ? titleImageList.ImageSize.Width : 0; backButton.Size = bbSize; // Header theme.SetParameters(VisualStyleElementEx.AeroWizard.HeaderArea.Normal); //headerLabel.Margin = theme.GetMargins2(g, MarginProperty.ContentMargins); //headerLabel.ForeColor = theme.GetColor(ColorProperty.TextColor); // Content theme.SetParameters(VisualStyleElementEx.AeroWizard.ContentArea.Normal); this.BackColor = theme.GetColor(ColorProperty.FillColor); Padding cp = theme.GetMargins2(g, MarginProperty.ContentMargins); //contentArea.ColumnStyles[0].Width = cp.Left; //contentArea.RowStyles[1].Height = cp.Bottom; // Command theme.SetParameters(VisualStyleElementEx.AeroWizard.CommandArea.Normal); cp = theme.GetMargins2(g, MarginProperty.ContentMargins); commandArea.RowStyles[0].Height = cp.Top; commandArea.RowStyles[2].Height = cp.Bottom; commandArea.ColumnStyles[2].Width = contentArea.ColumnStyles[contentCol + 1].Width = cp.Right; } } else { backButton.Size = new Size(30, 30);// new Size(Properties.Resources.BackBtnStrip.Width, Properties.Resources.BackBtnStrip.Height / 4); this.BackColor = UseAeroStyle ? SystemColors.Window : SystemColors.Control; } }