예제 #1
0
        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;
            }
        }