Esempio n. 1
0
        private static void CreateColor()
        {
            Color c = SystemColors.Control;

            c = Color.FromArgb((c.R + 255) / 2, (c.G + 255) / 2, (c.B + 255) / 2); //白との中間をとる

            _selectedColors = new DrawUtil.RoundRectColors();
            _selectedColors.border_color     = DrawUtil.ToCOLORREF(SystemColors.ControlDarkDark);
            _selectedColors.inner_color      = DrawUtil.ToCOLORREF(c);
            _selectedColors.outer_color      = DrawUtil.ToCOLORREF(SystemColors.Control);
            _selectedColors.lightlight_color = DrawUtil.MergeColor(_selectedColors.border_color, _selectedColors.outer_color);
            _selectedColors.light_color      = DrawUtil.MergeColor(_selectedColors.lightlight_color, _selectedColors.border_color);

            _hoverColors = new DrawUtil.RoundRectColors();
            _hoverColors.border_color     = DrawUtil.ToCOLORREF(DrawUtil.DarkColor(Color.Orange));
            _hoverColors.inner_color      = DrawUtil.ToCOLORREF(SystemColors.Control);
            _hoverColors.outer_color      = DrawUtil.ToCOLORREF(SystemColors.Control);
            _hoverColors.lightlight_color = DrawUtil.MergeColor(_hoverColors.border_color, _hoverColors.outer_color);
            _hoverColors.light_color      = DrawUtil.MergeColor(_hoverColors.lightlight_color, _hoverColors.border_color);
        }
Esempio n. 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            if (_selectedColors == null)
            {
                CreateColor();
            }
            //border
            if (_selected)
            {
                DrawUtil.DrawRoundRect(g, 0, 0, this.Width - 1, this.Height - 1, _selectedColors);
            }
            else if (_mouseEnter)
            {
                DrawUtil.DrawRoundRect(g, 0, 0, this.Width - 1, this.Height - 1, _hoverColors);
            }

            DrawButtonState(g);
        }