aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Engine/UI/ShiftButton.cs
blob: a025a4095fc5507f968cb4d5144b76aa139bdcdc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ShiftOS.Engine.UI
{
    public partial class ShiftButton : Control, IButtonControl
    {
        private bool _pressing = false;
        private Color _lightBack;
        public ShiftButton()
        {
            InitializeComponent();
        }

        public DialogResult DialogResult { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

        public void NotifyDefault(bool value)
        {

        }

        public void PerformClick()
        {
            this.OnClick(new EventArgs());
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
            this.Font = new Font("Lucida Console", 9, FontStyle.Regular);
            _lightBack = Color.WhiteSmoke;
            var g = pe.Graphics;
            g.Clear(BackColor);
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            var sf = new StringFormat();

            if (_pressing)
            {
                g.FillRectangle(new SolidBrush(Color.White), 0, 0, Width, Height);
                g.DrawString(Text, Font, new SolidBrush(Color.Black), ((Width / 2) + 1), (Height / 2) + 1);
            }
            else
            {
                g.FillRectangle(new SolidBrush(Color.WhiteSmoke), 0, 0, Width, Height);
            }
        }
    }
}