WIP: themed controls
No files matched your search
@@ -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
|
||||
|
||||
|
After Width: | Height: | Size: 601 B |
|
After Width: | Height: | Size: 417 B |
|
After Width: | Height: | Size: 590 B |
|
After Width: | Height: | Size: 410 B |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 419 B |
|
After Width: | Height: | Size: 372 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 288 B |
|
After Width: | Height: | Size: 532 B |
|
After Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 559 B |
|
After Width: | Height: | Size: 398 B |