WIP: themed controls

This commit is contained in:
Ray committed 2020-05-13 00:37:01 +01:00
1 parent c34e4f054b
commit 5ad779ddab
37 files changed
+1609 -435

No files matched your search

+20 -20
View File
@@ -11,20 +11,20 @@ namespace RyzStudio.Windows.Forms
{
public class FlatButton : Label
{
public class Style
public class FlatButtonStyle
{
public Color BackColour { get; set; } = Color.Transparent;
public Color PenColour { get; set; } = Color.Transparent;
}
public enum State
public enum FlatButtonState
{
Idle = 0,
Hover,
Down
}
protected State controlState = State.Idle;
protected FlatButtonState controlState = FlatButtonState.Idle;
public FlatButton() : base()
{
@@ -33,40 +33,40 @@ namespace RyzStudio.Windows.Forms
this.TextAlign = ContentAlignment.MiddleCenter;
// customise
this.StyleOver = new Style()
this.StyleOver = new FlatButtonStyle()
{
BackColour = Color.FromArgb(51, 51, 51),
PenColour = Color.White
};
this.StyleDown = new Style()
this.StyleDown = new FlatButtonStyle()
{
BackColour = Color.FromArgb(179, 179, 179),
PenColour = Color.Black
};
this.StyleDefault = new Style()
this.StyleDefault = new FlatButtonStyle()
{
BackColour = Color.White,
PenColour = Color.Black
};
this.VisualState = State.Idle;
this.VisualState = FlatButtonState.Idle;
this.Click += delegate { this.OnClick(null); };
this.MouseEnter += delegate { this.VisualState = State.Hover; };
this.MouseLeave += delegate { this.VisualState = State.Idle; };
this.MouseDown += delegate { this.VisualState = State.Down; };
this.MouseUp += delegate { this.VisualState = State.Idle; };
this.MouseEnter += delegate { this.VisualState = FlatButtonState.Hover; };
this.MouseLeave += delegate { this.VisualState = FlatButtonState.Idle; };
this.MouseDown += delegate { this.VisualState = FlatButtonState.Down; };
this.MouseUp += delegate { this.VisualState = FlatButtonState.Idle; };
}
protected State VisualState
protected FlatButtonState VisualState
{
get { return controlState; }
set
{
switch (value)
{
case State.Idle:
if (this.VisualState == State.Down)
case FlatButtonState.Idle:
if (this.VisualState == FlatButtonState.Down)
{
updateButton(StyleOver);
}
@@ -76,10 +76,10 @@ namespace RyzStudio.Windows.Forms
}
break;
case State.Hover:
case FlatButtonState.Hover:
updateButton(StyleOver);
break;
case State.Down:
case FlatButtonState.Down:
updateButton(StyleDown);
break;
default:
@@ -91,20 +91,20 @@ namespace RyzStudio.Windows.Forms
}
}
protected void updateButton(Style style)
protected void updateButton(FlatButtonStyle style)
{
this.ForeColor = style.PenColour;
this.BackColor = style.BackColour;
}
[Browsable(false)]
public Style StyleOver { get; set; } = new Style();
public FlatButtonStyle StyleOver { get; set; } = new FlatButtonStyle();
[Browsable(false)]
public Style StyleDown { get; set; } = new Style();
public FlatButtonStyle StyleDown { get; set; } = new FlatButtonStyle();
[Browsable(false)]
public Style StyleDefault { get; set; } = new Style();
public FlatButtonStyle StyleDefault { get; set; } = new FlatButtonStyle();
public void PerformClick()
{
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace RyzStudio.Windows.Forms
Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B