This commit is contained in:
Ray committed 2020-05-10 11:34:45 +01:00
1 parent adeb97dbb5
commit 7722340560
13 files changed
+70 -98

No files matched your search

@@ -1,9 +0,0 @@
namespace RyzStudio.Windows.ThemedForms
{
public enum ButtonState
{
Normal = 0,
Hover,
Down
}
}
@@ -1,25 +0,0 @@
namespace RyzStudio.Windows.ThemedForms
{
using System.Drawing;
public class ButtonStyle
{
public Color BackColour { get; set; }
public Color PenColour { get; set; }
public Image ForeImage { get; set; } = null;
public ButtonStyle(Color backColour, Color penColour)
{
this.BackColour = backColour;
this.PenColour = penColour;
this.ForeImage = null;
}
public ButtonStyle(Color backColour, Color penColour, Image foreImage)
{
this.BackColour = backColour;
this.PenColour = penColour;
this.ForeImage = foreImage;
}
}
}
@@ -6,11 +6,11 @@
using System.Drawing;
using System.Windows.Forms;
public partial class TextButtonBox : RyzStudio.Windows.ThemedForms.UserControl
public partial class ButtonTextBox : RyzStudio.Windows.ThemedForms.UserControl
{
protected readonly Padding textboxPadding = new Padding(6, 6, 6, 6);
public TextButtonBox() : base()
public ButtonTextBox() : base()
{
InitializeComponent();
@@ -63,7 +63,7 @@
break;
case Keys.Escape:
tryClose();
close();
break;
default: break;
}
@@ -112,7 +112,7 @@
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } }
protected override void updateBackground(Graphics g, ThemeStyle style)
protected override void updateBackground(Graphics g, Style style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
@@ -1,6 +1,6 @@
namespace RyzStudio.Windows.ThemedForms
{
partial class TextButtonBox
partial class ButtonTextBox
{
/// <summary>
/// Required designer variable.
+2 -2
View File
@@ -50,7 +50,7 @@
break;
case Keys.Escape:
tryClose();
close();
break;
default: break;
}
@@ -83,7 +83,7 @@
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get => base.Margin; set => base.Margin = value; }
protected override void updateBackground(Graphics g, ThemeStyle style)
protected override void updateBackground(Graphics g, Style style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
+2 -2
View File
@@ -49,7 +49,7 @@
break;
case Keys.Escape:
tryClose();
close();
break;
default: break;
}
@@ -82,7 +82,7 @@
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } }
protected override void updateBackground(Graphics g, ThemeStyle style)
protected override void updateBackground(Graphics g, Style style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
@@ -1,34 +0,0 @@
namespace RyzStudio.Windows.ThemedForms
{
using System.Drawing;
public struct ThemeStyle
{
public int BorderWidth;
public int BorderRadius;
public int BorderPadding;
public Color BorderColour;
public Color BackColour;
public Color ForeColour;
public ThemeStyle(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour)
{
this.BorderWidth = borderWidth;
this.BorderRadius = borderRadius;
this.BorderPadding = borderPadding;
this.BorderColour = borderColour;
this.BackColour = backColour;
this.ForeColour = Color.Black;
}
public ThemeStyle(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour, Color foreColour)
{
this.BorderWidth = borderWidth;
this.BorderRadius = borderRadius;
this.BorderPadding = borderPadding;
this.BorderColour = borderColour;
this.BackColour = backColour;
this.ForeColour = foreColour;
}
}
}
+40 -11
View File
@@ -1,15 +1,44 @@
namespace RyzStudio.Windows.ThemedForms
{
using System;
using System.Drawing;
using System.Windows.Forms;
using RyzStudio.Drawing;
using System.ComponentModel;
using System;
using System.Drawing;
using System.Windows.Forms;
using RyzStudio.Drawing;
using System.ComponentModel;
namespace RyzStudio.Windows.ThemedForms
{
public partial class UserControl : System.Windows.Forms.UserControl
{
//protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(112, 112, 112), Color.White);
protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White);
public class Style
{
public int BorderWidth;
public int BorderRadius;
public int BorderPadding;
public Color BorderColour;
public Color BackColour;
public Color ForeColour;
public Style(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour)
{
this.BorderWidth = borderWidth;
this.BorderRadius = borderRadius;
this.BorderPadding = borderPadding;
this.BorderColour = borderColour;
this.BackColour = backColour;
this.ForeColour = Color.Black;
}
public Style(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour, Color foreColour)
{
this.BorderWidth = borderWidth;
this.BorderRadius = borderRadius;
this.BorderPadding = borderPadding;
this.BorderColour = borderColour;
this.BackColour = backColour;
this.ForeColour = foreColour;
}
}
protected Style styleActive = new Style(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White);
public UserControl()
{
@@ -39,7 +68,7 @@
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Padding { get => base.Padding; set => base.Padding = value; }
protected virtual void updateBackground(Graphics g, ThemeStyle style)
protected virtual void updateBackground(Graphics g, Style style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
@@ -50,7 +79,7 @@
g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath());
}
protected virtual void tryClose()
protected virtual void close()
{
if (this.Parent == null)
{