Archived
Changed: simplified tile container uc
This commit is contained in:
1 parent
9e167916cb
commit
19ea78868b
13 files changed
+1256
-190
No files matched your search
@@ -1,17 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RyzStudio.Windows.Forms
|
||||
{
|
||||
public class TFlatButton : Label
|
||||
{
|
||||
public class FlatButtonStyle
|
||||
public class ButtonStyle
|
||||
{
|
||||
public Color BackColour { get; set; } = Color.Transparent;
|
||||
public Color PenColour { get; set; } = Color.Transparent;
|
||||
@@ -33,17 +27,17 @@ namespace RyzStudio.Windows.Forms
|
||||
this.TextAlign = ContentAlignment.MiddleCenter;
|
||||
|
||||
// customise
|
||||
this.StyleOver = new FlatButtonStyle()
|
||||
this.StyleOver = new ButtonStyle()
|
||||
{
|
||||
BackColour = Color.FromArgb(51, 51, 51),
|
||||
PenColour = Color.White
|
||||
};
|
||||
this.StyleDown = new FlatButtonStyle()
|
||||
this.StyleDown = new ButtonStyle()
|
||||
{
|
||||
BackColour = Color.FromArgb(179, 179, 179),
|
||||
PenColour = Color.Black
|
||||
};
|
||||
this.StyleDefault = new FlatButtonStyle()
|
||||
this.StyleDefault = new ButtonStyle()
|
||||
{
|
||||
BackColour = Color.White,
|
||||
PenColour = Color.Black
|
||||
@@ -91,20 +85,17 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateButton(FlatButtonStyle style)
|
||||
protected void updateButton(ButtonStyle style)
|
||||
{
|
||||
this.ForeColor = style.PenColour;
|
||||
this.BackColor = style.BackColour;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public FlatButtonStyle StyleOver { get; set; } = new FlatButtonStyle();
|
||||
protected ButtonStyle StyleOver { get; set; } = new ButtonStyle();
|
||||
|
||||
[Browsable(false)]
|
||||
public FlatButtonStyle StyleDown { get; set; } = new FlatButtonStyle();
|
||||
protected ButtonStyle StyleDown { get; set; } = new ButtonStyle();
|
||||
|
||||
[Browsable(false)]
|
||||
public FlatButtonStyle StyleDefault { get; set; } = new FlatButtonStyle();
|
||||
protected ButtonStyle StyleDefault { get; set; } = new ButtonStyle();
|
||||
|
||||
public void PerformClick()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RyzStudio.Windows.Forms
|
||||
{
|
||||
public class ThreadControl
|
||||
{
|
||||
public static void AddControl(Control control, Control value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() =>
|
||||
{
|
||||
control.Controls.Add(value);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Controls.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddItem(ListBox control, string value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.Items.Add(value);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Items.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Clear(ListBox control)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.Items.Clear();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Items.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetText(Control control, bool doTrim = true)
|
||||
{
|
||||
string rv = string.Empty;
|
||||
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
rv = (doTrim ? control.Text?.Trim() : control.Text);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = (doTrim ? control.Text?.Trim() : control.Text);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static int GetValue(NumericUpDown sender)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => {
|
||||
rv = (int)sender.Value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = (int)sender.Value;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
public string GetSelectedValue(ListBox sender)
|
||||
{
|
||||
string rv = string.Empty;
|
||||
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => {
|
||||
rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static void SetHeight(Control control, int value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.Height = value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Height = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetValue(Control control, string value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.Text = value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetWidth(Control control, int value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.Width = value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Width = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -108,117 +108,6 @@
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public void SetValue(Label sender, string value)
|
||||
{
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { sender.Text = value; }));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValue(GroupBox sender, string value)
|
||||
{
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { sender.Text = value; }));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddValue(ListBox sender, string value)
|
||||
{
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Items.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddControl(FlowLayoutPanel sender, Control value)
|
||||
{
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() =>
|
||||
{
|
||||
sender.Controls.Add(value);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Controls.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearValues(ListBox sender)
|
||||
{
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Items.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public string GetValue(ListBox sender)
|
||||
{
|
||||
string rv = string.Empty;
|
||||
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
public string GetValue(TTextBox sender)
|
||||
{
|
||||
string rv = string.Empty;
|
||||
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = sender.Text.Trim();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
public int GetValue(NumericUpDown sender)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; }));
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = (int)sender.Value;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
private void label1_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left)
|
||||
|
||||
@@ -102,17 +102,5 @@ namespace RyzStudio.Windows.ThemedForms
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValue(Label sender, string value)
|
||||
{
|
||||
if (sender.InvokeRequired)
|
||||
{
|
||||
sender.Invoke(new MethodInvoker(() => { sender.Text = value; }));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user