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

+20 -20
View File
@@ -6,21 +6,21 @@
public partial class TButton : RyzStudio.Windows.ThemedForms.TUserControl
{
public class Style
public class ButtonStyle
{
public Color BackColour { get; set; } = Color.Transparent;
public Color PenColour { get; set; } = Color.Transparent;
public Image ForeImage { get; set; } = null;
}
public enum State
public enum ButtonState
{
Idle = 0,
Hover,
Down
}
protected State controlState = State.Idle;
protected ButtonState controlState = ButtonState.Idle;
public TButton() : base()
{
@@ -29,10 +29,10 @@
label1.ImageAlign = ContentAlignment.MiddleCenter;
label1.Click += delegate { this.OnClick(null); };
label1.MouseEnter += delegate { this.VisualState = State.Hover; };
label1.MouseLeave += delegate { this.VisualState = State.Idle; };
label1.MouseDown += delegate { this.VisualState = State.Down; };
label1.MouseUp += delegate { this.VisualState = State.Idle; };
label1.MouseEnter += delegate { this.VisualState = ButtonState.Hover; };
label1.MouseLeave += delegate { this.VisualState = ButtonState.Idle; };
label1.MouseDown += delegate { this.VisualState = ButtonState.Down; };
label1.MouseUp += delegate { this.VisualState = ButtonState.Idle; };
}
protected override void OnLoad(EventArgs e)
@@ -40,37 +40,37 @@
base.OnLoad(e);
// customise
this.StyleOver = new Style()
this.StyleOver = new ButtonStyle()
{
BackColour = Color.FromArgb(51, 51, 51),
PenColour = Color.White,
ForeImage = this.OverImage
};
this.StyleDown = new Style()
this.StyleDown = new ButtonStyle()
{
BackColour = Color.FromArgb(179, 179, 179),
PenColour = Color.Black,
ForeImage = this.DownImage
};
this.StyleDefault = new Style()
this.StyleDefault = new ButtonStyle()
{
BackColour = Color.White,
PenColour = Color.Black,
ForeImage = this.DefaultImage
};
this.VisualState = State.Idle;
this.VisualState = ButtonState.Idle;
}
protected State VisualState
protected ButtonState VisualState
{
get { return controlState; }
set
{
switch (value)
{
case State.Idle:
if (this.VisualState == State.Down)
case ButtonState.Idle:
if (this.VisualState == ButtonState.Down)
{
updateButton(StyleOver);
}
@@ -80,10 +80,10 @@
}
break;
case State.Hover:
case ButtonState.Hover:
updateButton(StyleOver);
break;
case State.Down:
case ButtonState.Down:
updateButton(StyleDown);
break;
default:
@@ -95,7 +95,7 @@
}
}
protected void updateButton(Style style)
protected void updateButton(ButtonStyle style)
{
label1.ForeColor = style.PenColour;
label1.BackColor = style.BackColour;
@@ -119,13 +119,13 @@
public Image DefaultImage { get; set; } = null;
[Browsable(false)]
public Style StyleOver { get; set; } = new Style();
public ButtonStyle StyleOver { get; set; } = new ButtonStyle();
[Browsable(false)]
public Style StyleDown { get; set; } = new Style();
public ButtonStyle StyleDown { get; set; } = new ButtonStyle();
[Browsable(false)]
public Style StyleDefault { get; set; } = new Style();
public ButtonStyle StyleDefault { get; set; } = new ButtonStyle();
public void PerformClick() => this.OnClick(null);
}
@@ -69,7 +69,7 @@
}
}
private void imageBox1_Click(object sender, EventArgs e) => OnButtonClick?.Invoke(sender, e);
protected virtual void imageBox1_Click(object sender, EventArgs e) => OnButtonClick?.Invoke(sender, e);
[Category("Action")]
[Browsable(true)]
@@ -110,9 +110,9 @@
public TButton SubmitButton { get; set; } = null;
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } }
public new Padding Margin { get => base.Margin; set => base.Margin = value; }
protected override void updateBackground(Graphics g, Style style)
protected override void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
@@ -0,0 +1,41 @@
using System;
using System.IO;
using System.Windows.Forms;
namespace RyzStudio.Windows.ThemedForms
{
public class TFolderTextBox : TButtonTextBox
{
public TFolderTextBox() : base()
{
this.NormalImage = AppLauncher.Resource1.folder;
this.HighlightImage = AppLauncher.Resource1.folder2;
this.Text = string.Empty;
}
public FolderBrowserDialog FolderDialog { get; set; } = null;
protected override void imageBox1_Click(object sender, EventArgs e)
{
if (this.FolderDialog == null)
{
this.FolderDialog = new FolderBrowserDialog();
this.FolderDialog.Description = "Choose a directory";
}
if (!string.IsNullOrWhiteSpace(this.Text))
{
if (Directory.Exists(this.Text))
{
this.FolderDialog.SelectedPath = this.Text;
}
}
if (this.FolderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.Text = this.FolderDialog.SelectedPath;
}
}
}
}
+185 -45
View File
@@ -17,28 +17,192 @@
this.Font = new Font(this.Font, FontStyle.Regular);
this.Margin = new Padding(10, 4, 10, 4);
comboBox1.Font = this.Font;
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.PreviewKeyDown += textBox_PreviewKeyDown;
listBox1.Items.Add("one");
listBox1.Items.Add("two");
listBox1.Items.Add("three");
listBox1.Items.Add("four");
listBox1.Items.Add("five");
listBox1.Font = this.Font;
listBox1.BorderStyle = BorderStyle.None;
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
//int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
this.Height = comboBox1.Height + (b + textboxPadding.Top) + ((b - 1) + textboxPadding.Bottom);
//this.Height = comboBox1.Height + (b + textboxPadding.Top) + ((b - 1) + textboxPadding.Bottom);
}
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
comboBox1.Focus();
listBox1.Focus();
}
protected void textBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
public System.Windows.Forms.ListBox ListBox { get => listBox1; set => listBox1 = value; }
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
public TButton SubmitButton { get; set; } = null;
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get => base.Margin; set => base.Margin = value; }
[Category("Action")]
[Browsable(true)]
public event EventHandler OnAdd;
[Category("Action")]
[Browsable(true)]
public event EventHandler OnEdit;
protected override void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom));
Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth);
g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath());
g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath());
}
/// <summary>
/// Add
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
this.OnAdd?.Invoke(sender, e);
}
/// <summary>
/// Edit
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void imageBox5_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
this.OnEdit?.Invoke(sender, e);
}
/// <summary>
/// Remove
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void imageBox2_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
if (listBox1.SelectedIndex < 0)
{
return;
}
int pos = listBox1.SelectedIndex;
listBox1.Items.RemoveAt(pos);
if (pos > (listBox1.Items.Count - 1))
{
pos = (listBox1.Items.Count - 1);
}
listBox1.SelectedIndex = pos;
}
/// <summary>
/// Move up
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void imageBox3_MouseClick(object sender, MouseEventArgs e)
{
if (e != null)
{
if (e.Button != MouseButtons.Left)
{
return;
}
}
if (listBox1.SelectedIndex <= 0)
{
return;
}
if (listBox1.SelectedItem == null)
{
return;
}
object item = listBox1.SelectedItem;
int pos = listBox1.SelectedIndex;
listBox1.Items.RemoveAt(pos);
listBox1.Items.Insert((pos - 1), item);
listBox1.SelectedIndex = (pos - 1);
}
/// <summary>
/// Move down
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void imageBox4_MouseClick(object sender, MouseEventArgs e)
{
if (e != null)
{
if (e.Button != MouseButtons.Left)
{
return;
}
}
if (listBox1.SelectedIndex >= (listBox1.Items.Count - 1))
{
return;
}
if (listBox1.SelectedItem == null)
{
return;
}
object item = listBox1.SelectedItem;
int pos = listBox1.SelectedIndex;
listBox1.Items.RemoveAt(pos);
listBox1.Items.Insert((pos + 1), item);
listBox1.SelectedIndex = (pos + 1);
}
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) => imageBox5_MouseClick(sender, e);
private void listBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
switch (e.KeyCode)
{
@@ -51,48 +215,24 @@
break;
case Keys.Escape:
close();
break;
case Keys.Up:
if (e.Alt)
{
imageBox3_MouseClick(sender, null);
}
break;
case Keys.Down:
if (e.Alt)
{
imageBox4_MouseClick(sender, null);
}
break;
default: break;
}
}
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
public System.Windows.Forms.ComboBox ComboBox { get => comboBox1; set => comboBox1 = value; }
//[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
//[Category("Appearance")]
//public new string Text
//{
// get => textBox1.Text;
// set
// {
// textBox1.Text = value;
// textBox1.SelectionStart = textBox1.Text.Length;
// }
//}
//[Browsable(true)]
//[Category("Appearance")]
//public ComboBox.ObjectCollection Items { get => comboBox1.Items; set => comboBox1.Items = value; }
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
public TButton SubmitButton { get; set; } = null;
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get => base.Margin; set => base.Margin = value; }
protected override void updateBackground(Graphics g, Style style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom));
Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth);
g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath());
g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath());
}
}
}
+137 -14
View File
@@ -28,32 +28,155 @@
/// </summary>
private void InitializeComponent()
{
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.listBox1 = new System.Windows.Forms.ListBox();
this.imageBox5 = new RyzStudio.Windows.Forms.ImageBox();
this.imageBox4 = new RyzStudio.Windows.Forms.ImageBox();
this.imageBox3 = new RyzStudio.Windows.Forms.ImageBox();
this.imageBox2 = new RyzStudio.Windows.Forms.ImageBox();
this.imageBox1 = new RyzStudio.Windows.Forms.ImageBox();
((System.ComponentModel.ISupportInitialize)(this.imageBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit();
this.SuspendLayout();
//
// comboBox1
// listBox1
//
this.comboBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(4, 4);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(4, 4);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(121, 82);
this.listBox1.TabIndex = 0;
this.listBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDoubleClick);
this.listBox1.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.listBox1_PreviewKeyDown);
//
// PickerBox
// imageBox5
//
this.imageBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageBox5.BackColor = System.Drawing.Color.Transparent;
this.imageBox5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox5.ErrorImage = null;
this.imageBox5.HighlightImage = global::AppLauncher.Resource1.edit2;
this.imageBox5.Image = global::AppLauncher.Resource1.edit;
this.imageBox5.InitialImage = null;
this.imageBox5.Location = new System.Drawing.Point(52, 94);
this.imageBox5.Name = "imageBox5";
this.imageBox5.NormalImage = global::AppLauncher.Resource1.edit;
this.imageBox5.Size = new System.Drawing.Size(18, 25);
this.imageBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.imageBox5.TabIndex = 6;
this.imageBox5.TabStop = false;
this.imageBox5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox5_MouseClick);
this.imageBox5.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.imageBox5_MouseClick);
//
// imageBox4
//
this.imageBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageBox4.BackColor = System.Drawing.Color.Transparent;
this.imageBox4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox4.ErrorImage = null;
this.imageBox4.HighlightImage = global::AppLauncher.Resource1.arrow_down2;
this.imageBox4.Image = global::AppLauncher.Resource1.arrow_down;
this.imageBox4.InitialImage = null;
this.imageBox4.Location = new System.Drawing.Point(100, 94);
this.imageBox4.Name = "imageBox4";
this.imageBox4.NormalImage = global::AppLauncher.Resource1.arrow_down;
this.imageBox4.Size = new System.Drawing.Size(18, 25);
this.imageBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.imageBox4.TabIndex = 5;
this.imageBox4.TabStop = false;
this.imageBox4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox4_MouseClick);
this.imageBox4.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.imageBox4_MouseClick);
//
// imageBox3
//
this.imageBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageBox3.BackColor = System.Drawing.Color.Transparent;
this.imageBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox3.ErrorImage = null;
this.imageBox3.HighlightImage = global::AppLauncher.Resource1.arrow_up2;
this.imageBox3.Image = global::AppLauncher.Resource1.arrow_up;
this.imageBox3.InitialImage = null;
this.imageBox3.Location = new System.Drawing.Point(76, 94);
this.imageBox3.Name = "imageBox3";
this.imageBox3.NormalImage = global::AppLauncher.Resource1.arrow_up;
this.imageBox3.Size = new System.Drawing.Size(18, 25);
this.imageBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.imageBox3.TabIndex = 4;
this.imageBox3.TabStop = false;
this.imageBox3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox3_MouseClick);
this.imageBox3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.imageBox3_MouseClick);
//
// imageBox2
//
this.imageBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageBox2.BackColor = System.Drawing.Color.Transparent;
this.imageBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox2.ErrorImage = null;
this.imageBox2.HighlightImage = global::AppLauncher.Resource1.minus2;
this.imageBox2.Image = global::AppLauncher.Resource1.minus;
this.imageBox2.InitialImage = null;
this.imageBox2.Location = new System.Drawing.Point(28, 94);
this.imageBox2.Name = "imageBox2";
this.imageBox2.NormalImage = global::AppLauncher.Resource1.minus;
this.imageBox2.Size = new System.Drawing.Size(18, 25);
this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.imageBox2.TabIndex = 3;
this.imageBox2.TabStop = false;
this.imageBox2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox2_MouseClick);
this.imageBox2.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.imageBox2_MouseClick);
//
// imageBox1
//
this.imageBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.imageBox1.BackColor = System.Drawing.Color.Transparent;
this.imageBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox1.ErrorImage = null;
this.imageBox1.HighlightImage = global::AppLauncher.Resource1.plus2;
this.imageBox1.Image = global::AppLauncher.Resource1.plus;
this.imageBox1.InitialImage = null;
this.imageBox1.Location = new System.Drawing.Point(4, 94);
this.imageBox1.Name = "imageBox1";
this.imageBox1.NormalImage = global::AppLauncher.Resource1.plus;
this.imageBox1.Size = new System.Drawing.Size(18, 25);
this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.imageBox1.TabIndex = 2;
this.imageBox1.TabStop = false;
this.imageBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox1_MouseClick);
this.imageBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.imageBox1_MouseClick);
//
// TListBox
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.comboBox1);
this.Name = "PickerBox";
this.Controls.Add(this.imageBox5);
this.Controls.Add(this.imageBox4);
this.Controls.Add(this.imageBox3);
this.Controls.Add(this.imageBox2);
this.Controls.Add(this.imageBox1);
this.Controls.Add(this.listBox1);
this.Name = "TListBox";
this.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.Size = new System.Drawing.Size(128, 32);
this.Size = new System.Drawing.Size(128, 120);
((System.ComponentModel.ISupportInitialize)(this.imageBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ListBox listBox1;
private Forms.ImageBox imageBox1;
private Forms.ImageBox imageBox2;
private Forms.ImageBox imageBox3;
private Forms.ImageBox imageBox4;
private Forms.ImageBox imageBox5;
}
}
@@ -0,0 +1,42 @@
using System;
using System.IO;
using System.Windows.Forms;
namespace RyzStudio.Windows.ThemedForms
{
public class TOpenFileTextBox : TButtonTextBox
{
public TOpenFileTextBox() : base()
{
this.NormalImage = AppLauncher.Resource1.file;
this.HighlightImage = AppLauncher.Resource1.file2;
this.Text = string.Empty;
}
public OpenFileDialog FileDialog { get; set; } = null;
protected override void imageBox1_Click(object sender, EventArgs e)
{
if (this.FileDialog == null)
{
this.FileDialog = new OpenFileDialog();
this.FileDialog.Title = "Choose a file";
this.FileDialog.Filter = "All files|*";
}
if (!string.IsNullOrWhiteSpace(this.Text))
{
if (File.Exists(this.Text))
{
this.FileDialog.InitialDirectory = Path.GetDirectoryName(this.Text);
}
}
if (this.FileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.Text = this.FileDialog.FileName;
}
}
}
}
+1 -1
View File
@@ -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, Style style)
protected override void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
+1 -1
View File
@@ -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, Style style)
protected override void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
@@ -8,7 +8,7 @@ namespace RyzStudio.Windows.ThemedForms
{
public partial class TUserControl : System.Windows.Forms.UserControl
{
public class Style
public class ThemeStyle
{
public int BorderWidth;
public int BorderRadius;
@@ -17,7 +17,7 @@ namespace RyzStudio.Windows.ThemedForms
public Color BackColour;
public Color ForeColour;
public Style(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour)
public ThemeStyle(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour)
{
this.BorderWidth = borderWidth;
this.BorderRadius = borderRadius;
@@ -27,7 +27,7 @@ namespace RyzStudio.Windows.ThemedForms
this.ForeColour = Color.Black;
}
public Style(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour, Color foreColour)
public ThemeStyle(int borderWidth, int borderRadius, int borderPadding, Color borderColour, Color backColour, Color foreColour)
{
this.BorderWidth = borderWidth;
this.BorderRadius = borderRadius;
@@ -38,7 +38,7 @@ namespace RyzStudio.Windows.ThemedForms
}
}
protected Style styleActive = new Style(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White);
protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White);
public TUserControl()
{
@@ -68,7 +68,7 @@ namespace RyzStudio.Windows.ThemedForms
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Padding { get => base.Padding; set => base.Padding = value; }
protected virtual void updateBackground(Graphics g, Style style)
protected virtual void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;