2019-04-18 20:04:58 +00:00
|
|
|
|
namespace RyzStudio.Windows.ThemedForms
|
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Theme customised form
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class Form : System.Windows.Forms.Form
|
|
|
|
|
{
|
|
|
|
|
protected Image topImage = null;
|
|
|
|
|
protected Color topFillColour = Color.FromArgb(15, 15, 15);
|
|
|
|
|
protected int topFillHeight = 52;
|
|
|
|
|
|
|
|
|
|
protected Image bottomImage = null;
|
|
|
|
|
protected Color bottomFillColour = Color.FromArgb(15, 15, 15);
|
|
|
|
|
protected int bottomFillMargin = 19;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the Form class
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Form()
|
|
|
|
|
{
|
|
|
|
|
this.InitializeComponent();
|
|
|
|
|
|
|
|
|
|
this.BackColor = Color.FromArgb(246, 246, 246);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Onresize event
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e">Event argument</param>
|
|
|
|
|
protected override void OnResize(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnResize(e);
|
|
|
|
|
|
|
|
|
|
this.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// OnPaint event
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e">Event argument</param>
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnPaint(e);
|
|
|
|
|
|
|
|
|
|
Graphics g = e.Graphics;
|
|
|
|
|
|
|
|
|
|
Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, 0, this.DisplayRectangle.Width, topFillHeight);
|
|
|
|
|
Rectangle areaBottom = new Rectangle(this.DisplayRectangle.Left, (this.DisplayRectangle.Height - bottomFillMargin), this.DisplayRectangle.Width, bottomFillMargin);
|
|
|
|
|
|
|
|
|
|
// draw header
|
|
|
|
|
if (topFillHeight > 0)
|
|
|
|
|
{
|
|
|
|
|
g.FillRectangle(new SolidBrush(topFillColour), areaTop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// draw footer
|
|
|
|
|
if (bottomFillMargin > 0)
|
|
|
|
|
{
|
|
|
|
|
g.FillRectangle(new SolidBrush(bottomFillColour), areaBottom);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// draw logo
|
|
|
|
|
if (topImage != null)
|
|
|
|
|
{
|
|
|
|
|
g.DrawImageUnscaled(topImage, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bottomImage != null)
|
|
|
|
|
{
|
|
|
|
|
g.DrawImageUnscaled(bottomImage, 0, (this.DisplayRectangle.Height - bottomImage.Height - bottomFillMargin), this.DisplayRectangle.Width, bottomImage.Height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
2020-08-23 13:42:33 +00:00
|
|
|
|
public new Color BackColor { get => base.BackColor; set => base.BackColor = value; }
|
2019-04-18 20:04:58 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|