DrawThemeBackground() публичный статический Метод

Draws the background image defined by the visual style for the specified control part
public static DrawThemeBackground ( Graphics g, string windowClass, int part, int partState, Rectangle drawRect ) : void
g System.Drawing.Graphics The Graphics to draw on
windowClass string The class of the part to draw
part int The part to draw
partState int The state of the part to draw
drawRect System.Drawing.Rectangle The Rectangle in which the part is drawn
Результат void
Пример #1
0
        /// <summary>
        /// Draws a column header in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="headerRect">The Rectangle that represents the dimensions
        /// of the column header</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A ColumnHeaderStates value that specifies the
        /// state to draw the column header in</param>
        public static void DrawColumnHeader(Graphics g, Rectangle headerRect, Rectangle clipRect, ColumnHeaderStates state)
        {
            if (g == null || headerRect.Width <= 0 || headerRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.ColumnHeader, (int)ColumnHeaderParts.HeaderItem, (int)state, headerRect, clipRect);
            }
            else
            {
                g.FillRectangle(SystemBrushes.Control, headerRect);

                if (state == ColumnHeaderStates.Pressed)
                {
                    g.DrawRectangle(SystemPens.ControlDark, headerRect.X, headerRect.Y, headerRect.Width - 1, headerRect.Height - 1);
                }
                else
                {
                    ControlPaint.DrawBorder3D(g, headerRect.X, headerRect.Y, headerRect.Width, headerRect.Height, Border3DStyle.RaisedInner);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Draws an UpDown's up and down buttons in the specified state, on the specified
        /// graphics surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="upButtonRect">The Rectangle that represents the dimensions
        /// of the up button</param>
        /// <param name="upButtonClipRect">The Rectangle that represents the clipping area
        /// for the up button</param>
        /// <param name="upButtonState">An UpDownStates value that specifies the
        /// state to draw the up button in</param>
        /// <param name="downButtonRect">The Rectangle that represents the dimensions
        /// of the down button</param>
        /// <param name="downButtonClipRect">The Rectangle that represents the clipping area
        /// for the down button</param>
        /// <param name="downButtonState">An UpDownStates value that specifies the
        /// state to draw the down button in</param>
        public static void DrawUpDownButtons(Graphics g, Rectangle upButtonRect, Rectangle upButtonClipRect, UpDownStates upButtonState, Rectangle downButtonRect, Rectangle downButtonClipRect, UpDownStates downButtonState)
        {
            if (g == null)
            {
                return;
            }

            if (upButtonRect.Width > 0 && upButtonRect.Height > 0 && upButtonClipRect.Width > 0 && upButtonClipRect.Height > 0)
            {
                if (ThemeManager.VisualStylesEnabled)
                {
                    ThemeManager.DrawThemeBackground(g, ThemeClasses.UpDown, (int)UpDownParts.Up, (int)upButtonState, upButtonRect, upButtonClipRect);
                }
                else
                {
                    ControlPaint.DrawScrollButton(g, upButtonRect, ScrollButton.Up, ThemeManager.ConvertUpDownStateToButtonState(upButtonState));
                }
            }

            if (downButtonRect.Width > 0 && downButtonRect.Height > 0 && downButtonClipRect.Width > 0 && downButtonClipRect.Height > 0)
            {
                if (ThemeManager.VisualStylesEnabled)
                {
                    ThemeManager.DrawThemeBackground(g, ThemeClasses.UpDown, (int)UpDownParts.Down, (int)downButtonState, downButtonRect, downButtonClipRect);
                }
                else
                {
                    ControlPaint.DrawScrollButton(g, downButtonRect, ScrollButton.Down, ThemeManager.ConvertUpDownStateToButtonState(downButtonState));
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Draws a push button in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="buttonRect">The Rectangle that represents the dimensions
        /// of the button</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A PushButtonStates value that specifies the
        /// state to draw the button in</param>
        public static void DrawButton(Graphics g, Rectangle buttonRect, Rectangle clipRect, PushButtonStates state)
        {
            if (g == null || buttonRect.Width <= 0 || buttonRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.Button, (int)ButtonParts.PushButton, (int)state, buttonRect, clipRect);
            }
            else
            {
                ControlPaint.DrawButton(g, buttonRect, ThemeManager.ConvertPushButtonStateToButtonState(state));
            }
        }
Пример #4
0
        /// <summary>
        /// Draws a TextBox in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="textRect">The Rectangle that represents the dimensions
        /// of the TextBox</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A TextBoxStates value that specifies the
        /// state to draw the TextBox in</param>
        public static void DrawTextBox(Graphics g, Rectangle textRect, Rectangle clipRect, TextBoxStates state)
        {
            if (g == null || textRect.Width <= 0 || textRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.TextBox, (int)TextBoxParts.EditText, (int)state, textRect, clipRect);
            }
            else
            {
                ControlPaint.DrawBorder3D(g, textRect, Border3DStyle.Sunken);
            }
        }
Пример #5
0
        /// <summary>
        /// Draws a TabPage body on the specified graphics surface, and within the
        /// specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="tabRect">The Rectangle that represents the dimensions
        /// of the TabPage body</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        internal static void DrawTabPageBody(Graphics g, Rectangle tabRect, Rectangle clipRect)
        {
            if (g == null || tabRect.Width <= 0 || tabRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.TabControl, (int)TabParts.Body, 0, tabRect, clipRect);
            }
            else
            {
                g.FillRectangle(SystemBrushes.Control, Rectangle.Intersect(clipRect, tabRect));
            }
        }
Пример #6
0
        /// <summary>
        /// Draws the ProgressBar's chunks on the specified graphics surface, and within
        /// the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="drawRect">The Rectangle that represents the dimensions
        /// of the ProgressBar</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        public static void DrawProgressBarChunks(Graphics g, Rectangle drawRect, Rectangle clipRect)
        {
            if (g == null || drawRect.Width <= 0 || drawRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.ProgressBar, (int)ProgressBarParts.Chunk, 0, drawRect, clipRect);
            }
            else
            {
                g.FillRectangle(SystemBrushes.Highlight, drawRect);
            }
        }
Пример #7
0
        /// <summary>
        /// Draws a ProgressBar on the specified graphics surface, and within
        /// the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="drawRect">The Rectangle that represents the dimensions
        /// of the ProgressBar</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        public static void DrawProgressBar(Graphics g, Rectangle drawRect, Rectangle clipRect)
        {
            if (g == null || drawRect.Width <= 0 || drawRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.ProgressBar, (int)ProgressBarParts.Bar, 0, drawRect, clipRect);
            }
            else
            {
                // background
                g.FillRectangle(Brushes.White, drawRect);

                // 3d border
                //ControlPaint.DrawBorder3D(g, drawRect, Border3DStyle.SunkenInner);

                // flat border
                g.DrawRectangle(SystemPens.ControlDark, drawRect.Left, drawRect.Top, drawRect.Width - 1, drawRect.Height - 1);
            }
        }
Пример #8
0
        /// <summary>
        /// Draws a check box in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="checkRect">The Rectangle that represents the dimensions
        /// of the check box</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A CheckBoxStates value that specifies the
        /// state to draw the check box in</param>
        public static void DrawCheck(Graphics g, Rectangle checkRect, Rectangle clipRect, CheckBoxStates state)
        {
            if (g == null || checkRect.Width <= 0 || checkRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.Button, (int)ButtonParts.CheckBox, (int)state, checkRect, clipRect);
            }
            else
            {
                if (IsMixed(state))
                {
                    ControlPaint.DrawMixedCheckBox(g, checkRect, ThemeManager.ConvertCheckBoxStateToButtonState(state));
                }
                else
                {
                    ControlPaint.DrawCheckBox(g, checkRect, ThemeManager.ConvertCheckBoxStateToButtonState(state));
                }
            }
        }
Пример #9
0
 /// <summary>
 /// Draws the background image defined by the visual style for the specified control part
 /// </summary>
 /// <param name="g">The Graphics to draw on</param>
 /// <param name="windowClass">The class of the part to draw</param>
 /// <param name="part">The part to draw</param>
 /// <param name="partState">The state of the part to draw</param>
 /// <param name="drawRect">The Rectangle in which the part is drawn</param>
 public static void DrawThemeBackground(Graphics g, string windowClass, int part, int partState, Rectangle drawRect)
 {
     //
     ThemeManager.DrawThemeBackground(g, windowClass, part, partState, drawRect, drawRect);
 }