Archived
WIP: web parser + ui
This commit is contained in:
1 parent
c00d42a7d8
commit
682af23f55
11 files changed
+540
-147
No files matched your search
@@ -334,7 +334,6 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static List<T> FindChildControl<T>(Control control) where T : Control
|
||||
{
|
||||
List<T> rs = new List<T>();
|
||||
@@ -355,6 +354,24 @@ namespace RyzStudio.Windows.Forms
|
||||
return rs;
|
||||
}
|
||||
|
||||
public static 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 string GetText(Control control, bool doTrim = true)
|
||||
{
|
||||
string rv = string.Empty;
|
||||
@@ -373,6 +390,45 @@ namespace RyzStudio.Windows.Forms
|
||||
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 static bool IsChild(TreeNode dragNode, TreeNode dropNode)
|
||||
{
|
||||
TreeNode tn = dropNode;
|
||||
while (true)
|
||||
{
|
||||
if (tn.Parent == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (tn.Equals(dragNode))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
tn = tn.Parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void SetChecked(ToolStripMenuItem control, bool value)
|
||||
{
|
||||
if (control.GetCurrentParent().InvokeRequired)
|
||||
@@ -388,6 +444,50 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetClientHeight(Control control, int value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.ClientSize = new Size(control.ClientSize.Width, value);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.ClientSize = new Size(control.ClientSize.Width, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetClientSize(Control control, int width, int height) => SetClientSize(control, new Size(width, height));
|
||||
|
||||
public static void SetClientSize(Control control, Size value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.ClientSize = value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.ClientSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetClientWidth(Control control, int value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.ClientSize = new Size(value, control.ClientSize.Height);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.ClientSize = new Size(value, control.ClientSize.Height);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetEnable(Control control, bool value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
@@ -439,42 +539,6 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
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 static 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)
|
||||
@@ -503,36 +567,6 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetClientSize(Control control, int width, int height) => SetClientSize(control, new Size(width, height));
|
||||
|
||||
public static void SetClientSize(Control control, Size value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.ClientSize = value;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.ClientSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetClientHeight(Control control, int value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.ClientSize = new Size(control.ClientSize.Width, value);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.ClientSize = new Size(control.ClientSize.Width, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetSize(Control control, int width, int height) => SetSize(control, new Size(width, height));
|
||||
|
||||
public static void SetSize(Control control, Size value)
|
||||
@@ -671,19 +705,5 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetClientWidth(Control control, int value)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
{
|
||||
control.Invoke(new MethodInvoker(() => {
|
||||
control.ClientSize = new Size(value, control.ClientSize.Height);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
control.ClientSize = new Size(value, control.ClientSize.Height);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user