yangyin
2025-02-28 baa80d650adebcce70f1113cc1020c6039c159a0
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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Controls
{
    public class WenButtonClose : WenControl
    {
        public WenButtonClose()
        {
            this.Size = new Size(30, 30);
            this.Paint += WenButtonClose_Paint;
            this.MouseEnter += WenButtonClose_MouseEnter;
            this.MouseLeave += WenButtonClose_MouseLeave;
        }
 
        private void WenButtonClose_MouseLeave(object sender, EventArgs e)
        {
            BackColor = Color.Transparent;
        }
 
        private void WenButtonClose_MouseEnter(object sender, EventArgs e)
        {
            BackColor = Color.FromArgb(63, 63, 65);
        }
 
        private void WenButtonClose_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics.SetGDIHigh();
 
            using Pen p = new Pen(Color.White, 1);
 
            int z = Width > Height ? Height : Width / 2;
 
            Rectangle rec = new Rectangle((this.Width - z) / 2, (this.Height - z) / 2, z, z);
 
            g.DrawLine(p, rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height);
            g.DrawLine(p, rec.X, rec.Y + rec.Height, rec.X + rec.Width, rec.Y);
        }
    }
}