예제 #1
0
 private void toogle1_Click(object sender, EventArgs e)
 {
     if (toogle1.Checked)
     {
         this.BackColor = ExColorTranslator.Get("70, 70, 70");
     }
     else
     {
         this.BackColor = Color.White;
     }
 }
예제 #2
0
        private void InitBrushIfNeeded()
        {
            Color c = ExColorTranslator.Get(cbColor.Text);

            if (br == null)
            {
                br = new SolidBrush(c);
            }
            else
            {
                br.Color = c;
            }
        }
예제 #3
0
        //
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            var g = pevent.Graphics;

            if (BackgroundImage != null)
            {
                g.DrawImage(BackgroundImage, this.ClientRectangle);
                _navBackgroundBrush.Color = ExColorTranslator.Get("200, 200, 200, 200");
                g.FillRectangle(_navBackgroundBrush, ClientRectangle);
            }
            else
            {
                _navBackgroundBrush.Color = BackColor;
                g.FillRectangle(_navBackgroundBrush, ClientRectangle);
            }
        }
예제 #4
0
        public ButtonColors()
        {
            Bg     = ExColorTranslator.Get(C.Bg);
            Border = ExColorTranslator.Get(C.Border);
            Text   = ExColorTranslator.Get(C.Text);

            BgDisabled   = ExColorTranslator.Get(C.BgDisabled);
            TextDisabled = ExColorTranslator.Get(C.TextDisabled);

            BgHovered     = ExColorTranslator.Get(C.BgHovered);
            BorderHovered = ExColorTranslator.Get(C.BorderHovered);
            TextHovered   = ExColorTranslator.Get(C.TextHovered);

            BgFocused     = ExColorTranslator.Get(C.BgFocused);
            BorderFocused = ExColorTranslator.Get(C.BorderFocused);
            TextFocused   = ExColorTranslator.Get(C.TextFocused);
        }
예제 #5
0
        private void PaintItem(NavBarItemWrapper item, Graphics g)
        {
            if (item != _collapseExpandItem && (item.IsHovered || item.IsClicked))
            {
                _navItemBackgroundBrush.Color = ExColorTranslator.Get("128, 128, 128, 128");
                _navItemBorderPen.Color       = ExColorTranslator.Get("128, 93, 93, 93");

                g.FillRectangle(_navItemBackgroundBrush, item.Boundary);
                g.DrawRectangle(_navItemBorderPen, new Rectangle(-1, item.Boundary.Y, this.Width, item.Boundary.Height));
            }

            if (item.IsClicked)
            {
                g.FillRectangle(_navClickedItemBrush, new Rectangle(0, item.Boundary.Y + 1, 3 /*px*/, item.Boundary.Height - 1));
            }

            // Draw reveal highlight
            if (item.IsHovered && item != _collapseExpandItem)
            {
                if (_enableHighlightReveal)
                {
                    int halfRebelSize = 100;
                    // TODO:
                    // Brush created everytime so render performance will be decreased
                    // Replace with Translate matrix stuff
                    if (_navLeftRevealHighlightBrush != null)
                    {
                        _navLeftRevealHighlightBrush.Dispose();
                        _navLeftRevealHighlightBrush = null;
                    }

                    if (_navRightRevealHighlightBrush != null)
                    {
                        _navRightRevealHighlightBrush.Dispose();
                        _navRightRevealHighlightBrush = null;
                    }

                    Rectangle leftRevealHighlightRect  = new Rectangle(_mouseLocation.X - halfRebelSize, item.Boundary.Y, halfRebelSize, item.Boundary.Height + 1);
                    Rectangle rightRevealHighlightRect = new Rectangle(_mouseLocation.X, item.Boundary.Y, halfRebelSize, item.Boundary.Height + 1);
                    _navLeftRevealHighlightBrush = new LinearGradientBrush(
                        leftRevealHighlightRect,
                        ExColorTranslator.Get("0, 200, 200, 200"),
                        ExColorTranslator.Get("100, 255, 255, 255"), 0f);
                    _navRightRevealHighlightBrush = new LinearGradientBrush(
                        rightRevealHighlightRect,
                        ExColorTranslator.Get("100, 255, 255, 255"),
                        ExColorTranslator.Get("0, 200, 200, 200"), 0f);
                    g.FillRectangle(_navLeftRevealHighlightBrush, leftRevealHighlightRect);
                    g.FillRectangle(_navRightRevealHighlightBrush, rightRevealHighlightRect);
                }
            }

            if (item.Icon != null)
            {
                g.DrawImage(item.Icon, item.IconBoundary);
            }

            if (item != _collapseExpandItem)
            {
                g.DrawString(item.Text, Font, _navItemTextBrush, item.TextPosition);
            }

            // draw arrow and child item if needed
            if (item != _collapseExpandItem && item.Items != null)
            {
                if (item.IsExpanded)
                {
                    // Draw dropdown arrow only mouse enter nav bar
                    if (_isMouseIn && !_collapsing)
                    {
                        g.DrawImage(SvgPath8x8Mgr.Get("M0,0H8L4,8z", 1, Brushes.Black), item.DropDownButtonBoundary);
                    }
                    foreach (var childItem in item.Items)
                    {
                        PaintItem(childItem, g);
                    }
                }
                else
                {
                    // Draw dropdown arrow only mouse enter nav bar
                    if (_isMouseIn && !_collapsing)
                    {
                        g.DrawImage(SvgPath8x8Mgr.Get("M0,8H8L4,0z", 1, Brushes.Black), item.DropDownButtonBoundary);
                    }
                }
            }
        }