103 lines
3.4 KiB
C#
103 lines
3.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: RgbBuildButton
|
|
// 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.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Drawing.Drawing2D;
|
|
using System.Windows.Forms;
|
|
|
|
#nullable disable
|
|
[ToolboxItem(true)]
|
|
[ToolboxBitmap(typeof (Button))]
|
|
public class RgbBuildButton : Control
|
|
{
|
|
private bool hover;
|
|
private bool pressed;
|
|
private readonly Color baseColor = ColorTranslator.FromHtml("#5C3D8F");
|
|
private readonly Color hoverColor = ColorTranslator.FromHtml("#6E4AA6");
|
|
private readonly Color pressColor = ColorTranslator.FromHtml("#4A3173");
|
|
private readonly Color borderColor = ColorTranslator.FromHtml("#4A3173");
|
|
|
|
[Category("Custom")]
|
|
public Image Icon { get; set; }
|
|
|
|
[Category("Custom")]
|
|
public int IconSize { get; set; } = 16 /*0x10*/;
|
|
|
|
[Category("Custom")]
|
|
public int IconSpacing { get; set; } = 8;
|
|
|
|
public RgbBuildButton()
|
|
{
|
|
this.DoubleBuffered = true;
|
|
this.Size = new Size(220, 46);
|
|
this.Font = new Font("Segoe UI", 10.5f);
|
|
this.ForeColor = Color.White;
|
|
this.Cursor = Cursors.Arrow;
|
|
}
|
|
|
|
protected override void OnMouseEnter(EventArgs e)
|
|
{
|
|
this.hover = true;
|
|
this.Invalidate();
|
|
base.OnMouseEnter(e);
|
|
}
|
|
|
|
protected override void OnMouseLeave(EventArgs e)
|
|
{
|
|
this.hover = false;
|
|
this.pressed = false;
|
|
this.Invalidate();
|
|
base.OnMouseLeave(e);
|
|
}
|
|
|
|
protected override void OnMouseDown(MouseEventArgs e)
|
|
{
|
|
this.pressed = true;
|
|
this.Invalidate();
|
|
base.OnMouseDown(e);
|
|
}
|
|
|
|
protected override void OnMouseUp(MouseEventArgs e)
|
|
{
|
|
this.pressed = false;
|
|
this.Invalidate();
|
|
base.OnMouseUp(e);
|
|
}
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
{
|
|
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
|
Rectangle clientRectangle = this.ClientRectangle;
|
|
clientRectangle.Inflate(-1, -1);
|
|
using (SolidBrush solidBrush = new SolidBrush(this.pressed ? this.pressColor : (this.hover ? this.hoverColor : this.baseColor)))
|
|
e.Graphics.FillRectangle((Brush) solidBrush, clientRectangle);
|
|
using (Pen pen = new Pen(this.borderColor, 1f))
|
|
e.Graphics.DrawRectangle(pen, clientRectangle);
|
|
int num1 = this.pressed ? 1 : 0;
|
|
int num2 = 0;
|
|
if (this.Icon != null)
|
|
num2 += this.IconSize + this.IconSpacing;
|
|
Size size = TextRenderer.MeasureText(this.Text, this.Font);
|
|
int num3 = num2 + size.Width;
|
|
int x = clientRectangle.X + (clientRectangle.Width - num3) / 2;
|
|
if (this.Icon != null)
|
|
{
|
|
Rectangle rect = new Rectangle(x, clientRectangle.Y + (clientRectangle.Height - this.IconSize) / 2 + num1, this.IconSize, this.IconSize);
|
|
if (!this.Enabled)
|
|
{
|
|
using (SolidBrush solidBrush = new SolidBrush(Color.FromArgb(120, 0, 0, 0)))
|
|
e.Graphics.FillRectangle((Brush) solidBrush, clientRectangle);
|
|
}
|
|
e.Graphics.DrawImage(this.Icon, rect);
|
|
x += this.IconSize + this.IconSpacing;
|
|
}
|
|
Rectangle bounds = new Rectangle(x, clientRectangle.Y + num1, size.Width, clientRectangle.Height);
|
|
TextRenderer.DrawText((IDeviceContext) e.Graphics, this.Text, this.Font, bounds, this.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.NoPadding);
|
|
}
|
|
}
|