Что нового
Теневой форум

Добро пожаловать на FSELL- крупнейший теневой форум. У нас Вы сможете найти огромное количество заработка в интернете, купить паспорт, ксиву, оружие, куча многих товаров и услуг, в виде пробива, взлома, нанять киллера. Все это Вы найдете на нашем форуме! Не пренебрегайте услугами Гарант-Сервиса, это убережет Вас от мошенников.

C# .NET оформление Читов/лаунчеров (пример рендера)

SKWOSY

HACKER //
///Copyright © System Bot 2017
///Developer - iDReeM

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;


public class RenderAttribute : Attribute
{
/// <summary>
/// name of
/// </summary>
public string Name { get; set; }
/// <summary>
/// description
/// </summary>
public string Code { get; set; }
/// <summary>
/// null init
/// </summary>
public RenderAttribute() { }
/// <summary>
/// init attribute
/// </summary>
/// <param name="name">name of</param>
public RenderAttribute(string name) { Name = name; }
/// <summary>
/// init attribute
/// </summary>
/// <param name="name">name of</param>
/// <param name="code">description</param>
public RenderAttribute(string name, string code)
{
Name = name;
Code = code;
}
/// <summary>
/// finalize objects
/// </summary>
~RenderAttribute() { }
}
public class CRender
{
/// <summary>
/// Variable device
/// </summary>
[Render(Name = "m_pDevice", Code = "Graphics device")]
private readonly Graphics m_pDevice;
/// <summary>
/// init class CRender
/// </summary>
/// <param name="pDevice"></param>
public CRender(Graphics pDevice)
{
this.m_pDevice = pDevice;
this.m_pDevice.SmoothingMode = SmoothingMode.AntiAlias;
this.m_pDevice.TextRenderingHint = TextRenderingHint.AntiAlias;
}
/// <summary>
/// return Device
/// </summary>
[Render(Name = "Device", Code = "Graphics device public")]
public Graphics Device
{
get
{
return this.m_pDevice;
}
}
/// <summary>
/// check Graphics device
/// </summary>
/// <returns>true - draw, false - device is empty</returns>
[Render(Name = "DeviceEqualsNull", Code = "Equals")]
public bool DeviceEqualsNull()
{
return this.m_pDevice.Equals(default(Graphics));
}
/// <summary>
/// drawing box
/// </summary>
/// <param name="color">color border</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
[Render(Name = "render_Box", Code = "Draw")]
public void render_Box(Color color, int x, int y, int w, int h)
{
try
{
this.m_pDevice.FillRectangle(new SolidBrush(color), new Rectangle(new Point(x, y), new Size(w, h)));
}
catch (System.ArgumentNullException ex)
{
throw ex;//не указан цвет
}
}
/// <summary>
/// drawing box float coord
/// </summary>
/// <param name="color">color border</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
[Render(Name = "render_Box", Code = "Draw")]
public void render_Box(Color color, float x, float y, float w, float h)
{
try
{
this.m_pDevice.FillRectangle(new SolidBrush(color), new RectangleF(new PointF(x, y), new SizeF(w, h)));
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing border
/// </summary>
/// <param name="color">color border</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
[Render(Name = "render_Border", Code = "Draw")]
public void render_Border(Color color, int x, int y, int w, int h)
{
try
{
this.m_pDevice.DrawRectangle(new Pen(new SolidBrush(color)), new Rectangle(new Point(x, y), new Size(w, h)));
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing border float coord
/// </summary>
/// <param name="color">color border</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
[Render(Name = "render_Border", Code = "Draw")]
public void render_Border(Color color, float x, float y, float w, float h)
{
try
{
this.m_pDevice.DrawRectangle(new Pen(new SolidBrush(color)), x, y, w, h);
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing gradient box
/// </summary>
/// <param name="color1">color start gradient</param>
/// <param name="color2">color end gradient</param>
/// <param name="GMode">gradient mode</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
[Render(Name = "render_GradientBox", Code = "Draw")]
public void render_GradientBox(Color color1, Color color2, LinearGradientMode GMode, int x, int y, int w, int h)
{
LinearGradientBrush linGrBrush = new LinearGradientBrush(new Rectangle(new Point(x, y), new Size(w, h)), color1, color2, GMode);
try
{
this.m_pDevice.FillRectangle(linGrBrush, new Rectangle(new Point(x, y), new Size(w, h)));
linGrBrush.Dispose();
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing gradient border
/// </summary>
/// <param name="color1">color start gradient</param>
/// <param name="color2">color end gradient</param>
/// <param name="GMode">gradient mode</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
[Render(Name = "render_GradientBorder", Code = "Draw")]
public void render_GradientBorder(Color color1, Color color2, LinearGradientMode GMode, int x, int y, int w, int h)
{
LinearGradientBrush linGrBrush = new LinearGradientBrush(new Rectangle(new Point(x, y), new Size(w, h)), color1, color2, GMode);
try
{
this.m_pDevice.DrawRectangle(new Pen(linGrBrush), new Rectangle(new Point(x, y), new Size(w, h)));
linGrBrush.Dispose();
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing string
/// </summary>
/// <param name="str">string to draw</param>
/// <param name="color">color text</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="myFont"> font</param>
/// /// <param name="format"> format string DT_LEFT/CENTR</param>
[Render(Name = "render_String", Code = "Draw")]
public void render_String(string str, Color color, int x, int y, Font myFont, StringFormat format)
{
try
{
this.m_pDevice.DrawString(str, myFont, new SolidBrush(color), new Point(x, y), format);
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing string
/// </summary>
/// <param name="str">string to draw</param>
/// <param name="color">color text</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="myFont"> font</param>
[Render(Name = "render_String", Code = "Draw")]
public void render_String(string str, Color color, int x, int y, Font myFont)
{
try
{
this.m_pDevice.DrawString(str, myFont, new SolidBrush(color), new Point(x, y));
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing gradient string
/// </summary>
/// <param name="str">string to draw</param>
/// <param name="color1">color start gradient</param>
/// <param name="color2">color end gradient</param>
/// <param name="GMode">gradient mode</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="myFont"> font</param>
[Render(Name = "render_GradientString", Code = "Draw")]
public void render_GradientString(string str, Color color1, Color color2, LinearGradientMode GMode, int x, int y, Font myFont)
{
LinearGradientBrush linGrBrush = new LinearGradientBrush(new RectangleF(new PointF(x, y), new SizeF(myFont.Size, myFont.Size)), color1, color2, GMode);
try
{
this.m_pDevice.DrawString(str, myFont, linGrBrush, new Point(x, y));
linGrBrush.Dispose();
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
}
/// <summary>
/// drawing gradient string
/// </summary>
/// <param name="str">string to draw</param>
/// <param name="color1">color start gradient</param>
/// <param name="color2">color end gradient</param>
/// <param name="GMode">gradient mode</param>
/// <param name="x">x pos</param>
/// <param name="y">y pos</param>
/// <param name="myFont"> font</param>
[Render(Name = "render_GradientString", Code = "Draw")]
public void render_GradientString(string str, Color color1, Color color2, LinearGradientMode GMode, int x, int y, Font myFont, StringFormat format)
{
LinearGradientBrush linGrBrush = new LinearGradientBrush(new RectangleF(new PointF(x, y), new SizeF(myFont.Size, myFont.Size)), color1, color2, GMode);
try
{
this.m_pDevice.DrawString(str, myFont, linGrBrush, new Point(x, y), format);
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
finally
{
linGrBrush.Dispose();
}
}
/// <summary>
/// drawing image
/// </summary>
/// <param name="b">Картинка</param>
/// <param name="x">x</param>
/// <param name="y">y</param>
[Render(Name = "render_ImageUnscaled", Code = "Draw")]
public void render_ImageUnscaled(Bitmap b, int x, int y)
{
try
{
this.m_pDevice.DrawImageUnscaled(b, new Rectangle(new Point(x, y), b.Size));
}
catch (System.ArgumentNullException ex)
{
throw ex;
}
finally
{
b.Dispose();
}
}
~CRender()
{
//finalize
}
}
Атрибуты припаял для себя, по ним я чекал функции для протекции приложения в SEGuard (мойсамописный пакер).

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;


public class GUIButton : RadioButton
{
public GUIButton()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
base.Appearance = Appearance.Button;
base.FlatStyle = FlatStyle.Flat;
base.FlatAppearance.BorderSize = 0;
}

CRender pRenderContext;

Color colorBox1 = Color.FromArgb(129, 37, 46, 62);

Color colorBox2 = Color.FromArgb(69, 37, 46, 62);

protected override void OnMouseMove(MouseEventArgs mevent)
{
base.OnMouseMove(mevent);
this.colorBox1 = base.Checked ? Color.FromArgb(69, 124, 138, 151) : Color.FromArgb(255, 37, 46, 62);
}

protected override void OnMouseLeave(EventArgs eventargs)
{
base.OnMouseLeave(eventargs);
this.colorBox1 = base.Checked ? Color.FromArgb(255, 37, 46, 62) : Color.FromArgb(129, 37, 46, 62);

}

protected override void OnCheckedChanged(EventArgs e)
{
base.OnCheckedChanged(e);

this.colorBox2 = base.Checked ? Color.FromArgb(69, 134, 148, 161) : Color.FromArgb(69, 37, 46, 62);
this.colorBox1 = base.Checked ? Color.FromArgb(255, 37, 46, 62) : Color.FromArgb(69, 37, 46, 62);
}

protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);

Refresh();
Invalidate();
}

protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
Invalidate();
}

protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);

this.pRenderContext = new CRender(pevent.Graphics);

if (!this.pRenderContext.DeviceEqualsNull())
{
this.pRenderContext.Device.Clear(Parent.BackColor);
this.pRenderContext.render_GradientBox(colorBox1, colorBox2, LinearGradientMode.Horizontal, 0, 0, base.Width, base.Height);
this.pRenderContext.render_String(base.Text, Color.White, base.Width / 2, base.Height / 2, base.Font, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
if (base.Image != null)
{
this.pRenderContext.render_ImageUnscaled(new Bitmap(base.Image), 6, 4);
}
}
}
~GUIButton()
{

}
}
Вид: скриншот примера выше
SGcvc-N1SRme9kK4va4LFw.png
 
Вверх