initial commit
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: DarkModeForms.FlatProgressBar
|
||||
// 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.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#nullable disable
|
||||
namespace DarkModeForms;
|
||||
|
||||
public class FlatProgressBar : ProgressBar
|
||||
{
|
||||
private int min;
|
||||
private int max = 100;
|
||||
private int val;
|
||||
private Color BarColor = Color.Green;
|
||||
|
||||
public FlatProgressBar() => this.SetStyle(ControlStyles.UserPaint, true);
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs pevent)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e) => this.Invalidate();
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
SolidBrush solidBrush = new SolidBrush(this.BarColor);
|
||||
Brush brush = (Brush) new SolidBrush(this.BackColor);
|
||||
float num = (float) (this.val - this.min) / (float) (this.max - this.min);
|
||||
Rectangle clientRectangle = this.ClientRectangle;
|
||||
clientRectangle.Width = (int) ((double) clientRectangle.Width * (double) num);
|
||||
graphics.FillRectangle(brush, this.ClientRectangle);
|
||||
graphics.FillRectangle((Brush) solidBrush, clientRectangle);
|
||||
solidBrush.Dispose();
|
||||
graphics.Dispose();
|
||||
}
|
||||
|
||||
public new int Minimum
|
||||
{
|
||||
get => this.min;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
if (value > this.max)
|
||||
this.max = value;
|
||||
this.min = value;
|
||||
if (this.val < this.min)
|
||||
this.val = this.min;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public new int Maximum
|
||||
{
|
||||
get => this.max;
|
||||
set
|
||||
{
|
||||
if (value < this.min)
|
||||
this.min = value;
|
||||
this.max = value;
|
||||
if (this.val > this.max)
|
||||
this.val = this.max;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public new int Value
|
||||
{
|
||||
get => this.val;
|
||||
set
|
||||
{
|
||||
int val = this.val;
|
||||
this.val = value >= this.min ? (value <= this.max ? value : this.max) : this.min;
|
||||
Rectangle clientRectangle1 = this.ClientRectangle;
|
||||
Rectangle clientRectangle2 = this.ClientRectangle;
|
||||
float num1 = (float) (this.val - this.min) / (float) (this.max - this.min);
|
||||
clientRectangle1.Width = (int) ((double) clientRectangle1.Width * (double) num1);
|
||||
float num2 = (float) (val - this.min) / (float) (this.max - this.min);
|
||||
clientRectangle2.Width = (int) ((double) clientRectangle2.Width * (double) num2);
|
||||
Rectangle rc = new Rectangle();
|
||||
if (clientRectangle1.Width > clientRectangle2.Width)
|
||||
{
|
||||
rc.X = clientRectangle2.Size.Width;
|
||||
rc.Width = clientRectangle1.Width - clientRectangle2.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc.X = clientRectangle1.Size.Width;
|
||||
rc.Width = clientRectangle2.Width - clientRectangle1.Width;
|
||||
}
|
||||
rc.Height = this.Height;
|
||||
this.Invalidate(rc);
|
||||
}
|
||||
}
|
||||
|
||||
public Color ProgressBarColor
|
||||
{
|
||||
get => this.BarColor;
|
||||
set
|
||||
{
|
||||
this.BarColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user