예제 #1
0
        /// <summary>
        /// Draws Item Background.
        /// </summary>
        public void DrawItemBackGround()
        {
            if (Bounds.Height == 0 || Bounds.Width == 0)
            {
                return;
            }
            switch (State)
            {
            case State.Selected:
                PaintUtility.PaintGradientRectangle(Graphics, Bounds,
                                                    Item.Appearance.SelectedStyle.IsEmpty
                                                            ? Bar.CurrentAppearance.Item.SelectedStyle
                                                            : Item.Appearance.SelectedStyle);
                break;

            case State.Disabled:
                PaintUtility.PaintGradientRectangle(Graphics, Bounds,
                                                    Item.Appearance.DisabledStyle.IsEmpty
                                                            ? Bar.CurrentAppearance.Item.DisabledStyle
                                                            : Item.Appearance.DisabledStyle);
                break;

            case State.Hover:
                PaintUtility.PaintGradientRectangle(Graphics, Bounds,
                                                    Item.Appearance.HoverStyle.IsEmpty
                                                            ? Bar.CurrentAppearance.Item.HoverStyle
                                                            : Item.Appearance.HoverStyle);
                break;

            case State.SelectedHover:
                PaintUtility.PaintGradientRectangle(Graphics, Bounds,
                                                    Item.Appearance.SelectedHoverStyle.IsEmpty
                                                            ? Bar.CurrentAppearance.Item.SelectedHoverStyle
                                                            : Item.Appearance.SelectedHoverStyle);
                break;

            case State.Normal:
                PaintUtility.PaintGradientRectangle(Graphics, Bounds,
                                                    Item.Appearance.BackStyle.IsEmpty
                                                            ? Bar.CurrentAppearance.Item.BackStyle
                                                            : Item.Appearance.BackStyle);
                break;

            case State.Pressed:
                PaintUtility.PaintGradientRectangle(Graphics, Bounds,
                                                    Item.Appearance.ClickStyle.IsEmpty
                                                            ? Bar.CurrentAppearance.Item.ClickStyle
                                                            : Item.Appearance.ClickStyle);
                break;
            }
        }
예제 #2
0
            /// <summary>
            /// Handles the <see cref="E:CustomDrawItems" /> event.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="e">The <see cref="DrawItemsEventArgs"/> instance containing the event data.</param>
            private void OnCustomDrawItems(object sender, DrawItemsEventArgs e)
            {
                var o  = (AppearanceItem)pgrdItem.SelectedObject;
                var ts = o.AppearenceText.IsEmpty ? ZeroitToxicButton.DEFAULT.Item.AppearenceText : o.AppearenceText;

                switch (int.Parse(e.Item.Tag.ToString()))
                {
                case 1:
                    PaintUtility.PaintGradientRectangle(e.Graphics, e.Bounds,
                                                        o.DisabledStyle.IsEmpty
                                                                ? ZeroitToxicButton.DEFAULT.Item.DisabledStyle
                                                                : o.DisabledStyle);
                    PaintUtility.PaintBorder(e.Graphics, e.Bounds,
                                             o.DisabledBorder.IsEmpty
                                                     ? ZeroitToxicButton.DEFAULT.Item.DisabledBorder
                                                     : o.DisabledBorder);
                    PaintUtility.DrawString(e.Graphics, e.Bounds, e.Item.Caption, ts, false,
                                            o.DisabledForeGround.IsEmpty
                                                    ? ZeroitToxicButton.DEFAULT.Item.DisabledForeGround
                                                    : o.DisabledForeGround);
                    break;

                case 2:
                    PaintUtility.PaintGradientRectangle(e.Graphics, e.Bounds,
                                                        o.SelectedStyle.IsEmpty
                                                                ? ZeroitToxicButton.DEFAULT.Item.SelectedStyle
                                                                : o.SelectedStyle);
                    PaintUtility.PaintBorder(e.Graphics, e.Bounds,
                                             o.SelectedBorder.IsEmpty
                                                     ? ZeroitToxicButton.DEFAULT.Item.SelectedBorder
                                                     : o.SelectedBorder);
                    PaintUtility.DrawString(e.Graphics, e.Bounds, e.Item.Caption, ts, false,
                                            o.SelectedForeGround.IsEmpty
                                                    ? ZeroitToxicButton.DEFAULT.Item.SelectedForeGround
                                                    : o.SelectedForeGround);
                    break;

                case 3:
                    PaintUtility.PaintGradientRectangle(e.Graphics, e.Bounds,
                                                        o.ClickStyle.IsEmpty
                                                                ? ZeroitToxicButton.DEFAULT.Item.ClickStyle
                                                                : o.ClickStyle);
                    PaintUtility.PaintBorder(e.Graphics, e.Bounds,
                                             o.SelectedBorder.IsEmpty
                                                     ? ZeroitToxicButton.DEFAULT.Item.SelectedBorder
                                                     : o.SelectedBorder);
                    PaintUtility.DrawString(e.Graphics, e.Bounds, e.Item.Caption, ts, false,
                                            o.SelectedForeGround.IsEmpty
                                                    ? ZeroitToxicButton.DEFAULT.Item.SelectedForeGround
                                                    : o.SelectedForeGround);
                    break;

                case 4:
                    PaintUtility.PaintGradientRectangle(e.Graphics, e.Bounds,
                                                        o.HoverStyle.IsEmpty
                                                                ? ZeroitToxicButton.DEFAULT.Item.HoverStyle
                                                                : o.HoverStyle);
                    PaintUtility.PaintBorder(e.Graphics, e.Bounds,
                                             o.HoverBorder.IsEmpty
                                                     ? ZeroitToxicButton.DEFAULT.Item.HoverBorder
                                                     : o.HoverBorder);
                    PaintUtility.DrawString(e.Graphics, e.Bounds, e.Item.Caption, ts, false,
                                            o.HoverForeGround.IsEmpty
                                                    ? ZeroitToxicButton.DEFAULT.Item.HoverForeGround
                                                    : o.HoverForeGround);
                    break;

                case 5:
                    PaintUtility.PaintGradientRectangle(e.Graphics, e.Bounds,
                                                        o.SelectedHoverStyle.IsEmpty
                                                                ? ZeroitToxicButton.DEFAULT.Item.SelectedHoverStyle
                                                                : o.SelectedHoverStyle);
                    PaintUtility.PaintBorder(e.Graphics, e.Bounds,
                                             o.HoverBorder.IsEmpty
                                                     ? ZeroitToxicButton.DEFAULT.Item.HoverBorder
                                                     : o.HoverBorder);
                    PaintUtility.DrawString(e.Graphics, e.Bounds, e.Item.Caption, ts, false,
                                            o.HoverForeGround.IsEmpty
                                                    ? ZeroitToxicButton.DEFAULT.Item.HoverForeGround
                                                    : o.HoverForeGround);
                    break;

                default:
                    PaintUtility.PaintGradientRectangle(e.Graphics, e.Bounds,
                                                        o.BackStyle.IsEmpty
                                                                ? ZeroitToxicButton.DEFAULT.Item.BackStyle
                                                                : o.BackStyle);
                    PaintUtility.PaintBorder(e.Graphics, e.Bounds,
                                             o.NormalBorder.IsEmpty
                                                     ? ZeroitToxicButton.DEFAULT.Item.NormalBorder
                                                     : o.NormalBorder);
                    PaintUtility.DrawString(e.Graphics, e.Bounds, e.Item.Caption, ts, false,
                                            o.NormalForeGround.IsEmpty
                                                    ? ZeroitToxicButton.DEFAULT.Item.NormalForeGround
                                                    : o.NormalForeGround);
                    break;
                }
                e.Handeled = true;
            }