Esempio n. 1
0
        //
        public TitleBar()
        {
            // control button setup
            _minimizeEnable = true;
            _maximizeEnable = true;

            // img setup
            _normalImg   = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Normal, 2, Brushes.Black, SmoothingMode.Default);
            _maximizeImg = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Maximized, 2, Brushes.Black, SmoothingMode.Default);

            _minimizeButton = new TitleBarControlButton {
                Image = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Minimize, 2, Brushes.Black, SmoothingMode.Default)
            };
            _maximizeButton = new TitleBarControlButton {
                Image = _normalImg
            };
            _closeButton = new TitleBarControlButton {
                Image = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Close, 2, Brushes.Black, SmoothingMode.Default)
            };

            _textBrush        = BrushCreator.CreateSolidBrush();
            _hoverBrush       = BrushCreator.CreateSolidBrush("#FFF0F0F0");
            _controlButtonPen = PenCreator.Create();

            DoubleBuffered = true;
        }
Esempio n. 2
0
        private void RedrawIfButtonHoverStateChange(TitleBarControlButton btn, Point location)
        {
            var isMouseHover = btn.Contains(location);

            if (isMouseHover != btn.IsMouseHover)
            {
                btn.IsMouseHover = isMouseHover;
                Invalidate(btn.Boundary);
            }
        }
Esempio n. 3
0
 private void PaintControlButton(TitleBarControlButton button, Graphics g)
 {
     if (button.IsMouseHover)
     {
         g.FillRectangle(_hoverBrush, button.Boundary);
     }
     if (button.Image != null)
     {
         g.DrawImage(button.Image, button.ImageBoundary);
     }
 }