initial commit
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: DarkModeForms.MyRenderer
|
||||
// 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.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#nullable disable
|
||||
namespace DarkModeForms;
|
||||
|
||||
public class MyRenderer : ToolStripProfessionalRenderer
|
||||
{
|
||||
public bool ColorizeIcons { get; set; } = true;
|
||||
|
||||
public OSThemeColors MyColors { get; set; }
|
||||
|
||||
public MyRenderer(ProfessionalColorTable table, bool pColorizeIcons = true)
|
||||
: base(table)
|
||||
{
|
||||
this.ColorizeIcons = pColorizeIcons;
|
||||
}
|
||||
|
||||
private void DrawTitleBar(Graphics g, Rectangle rect)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
|
||||
{
|
||||
this.DrawTitleBar(e.Graphics, new Rectangle(0, 0, e.ToolStrip.Width, 7));
|
||||
}
|
||||
|
||||
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
|
||||
{
|
||||
this.DrawTitleBar(e.Graphics, new Rectangle(0, 0, e.ToolStrip.Width, 7));
|
||||
}
|
||||
|
||||
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
|
||||
{
|
||||
e.ToolStrip.BackColor = this.MyColors.Background;
|
||||
base.OnRenderToolStripBackground(e);
|
||||
}
|
||||
|
||||
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
Rectangle rect = new Rectangle(Point.Empty, e.Item.Size);
|
||||
Color color1 = this.MyColors.Background;
|
||||
Color color2 = this.MyColors.Background;
|
||||
Pen pen = new Pen(this.MyColors.Background);
|
||||
ToolStripButton toolStripButton = e.Item as ToolStripButton;
|
||||
if (toolStripButton.Pressed || toolStripButton.Checked)
|
||||
{
|
||||
color1 = this.MyColors.Control;
|
||||
color2 = this.MyColors.Control;
|
||||
}
|
||||
else if (toolStripButton.Selected)
|
||||
{
|
||||
color1 = this.MyColors.Accent;
|
||||
color2 = this.MyColors.Accent;
|
||||
}
|
||||
using (Brush brush = (Brush) new LinearGradientBrush(rect, color1, color2, LinearGradientMode.Vertical))
|
||||
graphics.FillRectangle(brush, rect);
|
||||
e.Graphics.DrawRectangle(pen, rect);
|
||||
graphics.DrawLine(pen, rect.X, rect.Y, rect.Width - 1, rect.Y);
|
||||
graphics.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Height - 1);
|
||||
ToolStrip owner1 = toolStripButton.Owner;
|
||||
ToolStrip owner2 = toolStripButton.Owner;
|
||||
Rectangle bounds = toolStripButton.Bounds;
|
||||
int x = bounds.X;
|
||||
bounds = toolStripButton.Bounds;
|
||||
int y = bounds.Bottom + 1;
|
||||
if (owner2.GetItemAt(x, y) is ToolStripButton)
|
||||
return;
|
||||
graphics.DrawLine(pen, rect.X, rect.Height - 1, rect.X + rect.Width - 1, rect.Height - 1);
|
||||
}
|
||||
|
||||
protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
Rectangle rect = new Rectangle(Point.Empty, e.Item.Size);
|
||||
Color color1 = this.MyColors.Background;
|
||||
Color color2 = this.MyColors.Background;
|
||||
Pen pen = new Pen(this.MyColors.Background);
|
||||
if (e.Item.Pressed)
|
||||
{
|
||||
color1 = this.MyColors.Control;
|
||||
color2 = this.MyColors.Control;
|
||||
}
|
||||
else if (e.Item.Selected)
|
||||
{
|
||||
color1 = this.MyColors.Accent;
|
||||
color2 = this.MyColors.Accent;
|
||||
}
|
||||
using (Brush brush = (Brush) new LinearGradientBrush(rect, color1, color2, LinearGradientMode.Vertical))
|
||||
e.Graphics.FillRectangle(brush, rect);
|
||||
}
|
||||
|
||||
protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
Rectangle rect = new Rectangle(Point.Empty, e.Item.Size);
|
||||
Color color1 = this.MyColors.Background;
|
||||
Color color2 = this.MyColors.Background;
|
||||
if (e.Item.Pressed)
|
||||
{
|
||||
color1 = this.MyColors.Control;
|
||||
color2 = this.MyColors.Control;
|
||||
}
|
||||
else if (e.Item.Selected)
|
||||
{
|
||||
color1 = this.MyColors.Accent;
|
||||
color2 = this.MyColors.Accent;
|
||||
}
|
||||
using (Brush brush = (Brush) new LinearGradientBrush(rect, color1, color2, LinearGradientMode.Vertical))
|
||||
e.Graphics.FillRectangle(brush, rect);
|
||||
int num = 2;
|
||||
Size size = new Size(8, 4);
|
||||
Pen pen = new Pen(this.MyColors.TextInactive, 2f);
|
||||
Point pt1_1 = new Point(rect.Width - (size.Width + num), rect.Height / 2 - size.Height / 2);
|
||||
Point pt1_2 = new Point(rect.Width - num, rect.Height / 2 - size.Height / 2);
|
||||
Point pt2 = new Point(rect.Width - (size.Width / 2 + num), rect.Height / 2 + size.Height / 2);
|
||||
e.Graphics.DrawLine(pen, pt1_1, pt2);
|
||||
e.Graphics.DrawLine(pen, pt1_2, pt2);
|
||||
}
|
||||
|
||||
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
||||
{
|
||||
e.TextColor = !e.Item.Enabled ? this.MyColors.TextInactive : this.MyColors.TextActive;
|
||||
base.OnRenderItemText(e);
|
||||
}
|
||||
|
||||
protected override void OnRenderItemBackground(ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
base.OnRenderItemBackground(e);
|
||||
if (!(e.Item is ToolStripComboBox))
|
||||
return;
|
||||
Rectangle rect = new Rectangle(Point.Empty, e.Item.Size);
|
||||
e.Graphics.DrawRectangle(new Pen(this.MyColors.ControlLight, 1f), rect);
|
||||
}
|
||||
|
||||
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
Rectangle rect = new Rectangle(Point.Empty, e.Item.Size);
|
||||
Color color1 = this.MyColors.Background;
|
||||
Color color2 = this.MyColors.Background;
|
||||
bool flag = false;
|
||||
ToolStripItem toolStripItem = e.Item;
|
||||
if (toolStripItem.Pressed)
|
||||
{
|
||||
color1 = this.MyColors.Control;
|
||||
color2 = this.MyColors.Control;
|
||||
flag = true;
|
||||
}
|
||||
else if (toolStripItem.Selected)
|
||||
{
|
||||
color1 = this.MyColors.Accent;
|
||||
color2 = this.MyColors.Accent;
|
||||
flag = true;
|
||||
}
|
||||
if (!flag)
|
||||
return;
|
||||
using (Brush brush = (Brush) new LinearGradientBrush(rect, color1, color2, LinearGradientMode.Vertical))
|
||||
graphics.FillRectangle(brush, rect);
|
||||
}
|
||||
|
||||
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
|
||||
{
|
||||
if (e.Item.GetType().FullName == "System.Windows.Forms.MdiControlStrip+ControlBoxMenuItem")
|
||||
{
|
||||
using (Image color = DarkModeCS.ChangeToColor(e.Image, e.Item.Enabled ? this.MyColors.TextActive : this.MyColors.SurfaceDark))
|
||||
{
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
|
||||
e.Graphics.CompositingQuality = CompositingQuality.AssumeLinear;
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
e.Graphics.DrawImage(color, e.ImageRectangle);
|
||||
}
|
||||
}
|
||||
else if (this.ColorizeIcons && e.Image != null)
|
||||
{
|
||||
using (Image color = DarkModeCS.ChangeToColor(e.Image, e.Item.Enabled ? this.MyColors.TextInactive : this.MyColors.SurfaceDark))
|
||||
{
|
||||
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
|
||||
e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
e.Graphics.DrawImage(color, e.ImageRectangle);
|
||||
}
|
||||
}
|
||||
else
|
||||
base.OnRenderItemImage(e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user