-
Notifications
You must be signed in to change notification settings - Fork 0
/
GradientPanel.cs
48 lines (42 loc) · 1.7 KB
/
GradientPanel.cs
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
// Decompiled with JetBrains decompiler
// Type: GradientPanel
// Assembly: WumbasWigwam, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 9E1B20CF-FC55-4FDF-8F94-7BCA06D01AA5
// Assembly location: C:\Users\Spice\Desktop\RareHacking\WumbasWigwam\WumbasWigwam.exe
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
public class GradientPanel : Panel
{
public Color color1 = Color.Black;
public Color color2 = Color.White;
public GradientPanel() => this.ResizeRedraw = true;
protected override void OnPaintBackground(PaintEventArgs e)
{
using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(this.ClientRectangle, this.color1, this.color2, LinearGradientMode.ForwardDiagonal))
e.Graphics.FillRectangle((Brush) linearGradientBrush, this.ClientRectangle);
}
public Color GetPixel(int x, int y)
{
Rectangle clientRectangle = this.ClientRectangle;
int width = clientRectangle.Width;
clientRectangle = this.ClientRectangle;
int height = clientRectangle.Height;
using (Bitmap bitmap = new Bitmap(width, height))
{
using (Graphics graphics = Graphics.FromImage((Image) bitmap))
{
using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, bitmap.Width, bitmap.Height), this.color1, this.color2, LinearGradientMode.Vertical))
{
graphics.FillRectangle((Brush) linearGradientBrush, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
return bitmap.GetPixel(x, y);
}
}
}
}
protected override void OnScroll(ScrollEventArgs se)
{
this.Invalidate();
base.OnScroll(se);
}
}