78 lines
2.4 KiB
C#
78 lines
2.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: TextBoxButton
|
||
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
||
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
||
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
||
|
|
|
||
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Drawing;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Windows.Forms;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
public class TextBoxButton : Button
|
||
|
|
{
|
||
|
|
private bool hovered;
|
||
|
|
private bool pressed;
|
||
|
|
|
||
|
|
public TextBoxButton()
|
||
|
|
{
|
||
|
|
this.FlatStyle = FlatStyle.Flat;
|
||
|
|
this.FlatAppearance.BorderSize = 0;
|
||
|
|
this.BackColor = Color.FromArgb(32 /*0x20*/, 32 /*0x20*/, 32 /*0x20*/);
|
||
|
|
this.ForeColor = Color.White;
|
||
|
|
this.Font = new Font(((IEnumerable<FontFamily>) FontFamily.Families).Any<FontFamily>((Func<FontFamily, bool>) (f => f.Name == "Microsoft JhengHei")) ? "Microsoft JhengHei" : "Segoe UI", 9f);
|
||
|
|
this.Cursor = Cursors.Hand;
|
||
|
|
this.Height = 26;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnMouseEnter(EventArgs e)
|
||
|
|
{
|
||
|
|
this.hovered = true;
|
||
|
|
this.Invalidate();
|
||
|
|
base.OnMouseEnter(e);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnMouseLeave(EventArgs e)
|
||
|
|
{
|
||
|
|
this.hovered = false;
|
||
|
|
this.pressed = false;
|
||
|
|
this.Invalidate();
|
||
|
|
base.OnMouseLeave(e);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnMouseDown(MouseEventArgs mevent)
|
||
|
|
{
|
||
|
|
this.pressed = true;
|
||
|
|
this.Invalidate();
|
||
|
|
base.OnMouseDown(mevent);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnMouseUp(MouseEventArgs mevent)
|
||
|
|
{
|
||
|
|
this.pressed = false;
|
||
|
|
this.Invalidate();
|
||
|
|
base.OnMouseUp(mevent);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnPaint(PaintEventArgs e)
|
||
|
|
{
|
||
|
|
e.Graphics.Clear(this.Parent.BackColor);
|
||
|
|
Rectangle clientRectangle = this.ClientRectangle;
|
||
|
|
--clientRectangle.Width;
|
||
|
|
--clientRectangle.Height;
|
||
|
|
Color color1 = Color.FromArgb(100, 100, 100);
|
||
|
|
Color color2 = this.BackColor;
|
||
|
|
if (this.hovered)
|
||
|
|
color1 = Color.FromArgb(100, 100, 100);
|
||
|
|
if (this.pressed)
|
||
|
|
color2 = Color.FromArgb(28, 28, 28);
|
||
|
|
using (SolidBrush solidBrush = new SolidBrush(color2))
|
||
|
|
e.Graphics.FillRectangle((Brush) solidBrush, clientRectangle);
|
||
|
|
using (Pen pen = new Pen(color1))
|
||
|
|
e.Graphics.DrawRectangle(pen, clientRectangle);
|
||
|
|
TextRenderer.DrawText((IDeviceContext) e.Graphics, this.Text, this.Font, clientRectangle, this.ForeColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
|
||
|
|
}
|
||
|
|
}
|