Changed: updated threadcontrols
This commit is contained in:
		
							parent
							
								
									99321d1e96
								
							
						
					
					
						commit
						96af2b6b3d
					
				@ -430,7 +430,7 @@ namespace AppLauncher
 | 
				
			|||||||
                        TTilePanelLayout panel = new TTilePanelLayout(item);
 | 
					                        TTilePanelLayout panel = new TTilePanelLayout(item);
 | 
				
			||||||
                        maxWidth = Math.Max(maxWidth, panel.Width);
 | 
					                        maxWidth = Math.Max(maxWidth, panel.Width);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        ThreadControl.AddControl(flowLayoutPanel1, panel);
 | 
					                        ThreadControl.Add(flowLayoutPanel1, panel);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    public class ThreadControl
 | 
					    public class ThreadControl
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public static void AddControl(Control control, Control value)
 | 
					        public static void Add(Control control, Control value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -25,7 +25,7 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void AddItem(ListBox control, string value)
 | 
					        public static void Add(ListBox control, string value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -39,6 +39,130 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //public static void Add(FlowLayoutPanel control, Control value)
 | 
				
			||||||
 | 
					        //{
 | 
				
			||||||
 | 
					        //    if (control.InvokeRequired)
 | 
				
			||||||
 | 
					        //    {
 | 
				
			||||||
 | 
					        //        control.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					        //            control.Controls.Add(value);
 | 
				
			||||||
 | 
					        //        }));
 | 
				
			||||||
 | 
					        //    }
 | 
				
			||||||
 | 
					        //    else
 | 
				
			||||||
 | 
					        //    {
 | 
				
			||||||
 | 
					        //        control.Controls.Add(value);
 | 
				
			||||||
 | 
					        //    }
 | 
				
			||||||
 | 
					        //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static int Add(TreeView control, TreeNode value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            int n = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    n = control.Nodes.Add(value);
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                n = control.Nodes.Add(value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return n;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static int Add(TreeNode control, TreeNode value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            int n = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (control.TreeView.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.TreeView.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    n = control.Nodes.Add(value);
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                n = control.Nodes.Add(value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return n;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static int Add(DataGridView control, object[] value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            int n = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    n = control.Rows.Add(value);
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                n = control.Rows.Add(value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return n;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static int Add(DataGridView control, object[] value, object tag)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            int n = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    n = control.Rows.Add(value);
 | 
				
			||||||
 | 
					                    control.Rows[n].Tag = tag;
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                n = control.Rows.Add(value);
 | 
				
			||||||
 | 
					                control.Rows[n].Tag = tag;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return n;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static TreeNode Add(TreeView control, string key, string text)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            TreeNode rv = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    rv = control.Nodes.Add(key, text);
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                rv = control.Nodes.Add(key, text);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return rv;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static TreeNode Add(TreeNode control, string key, string text)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            TreeNode rv = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (control.TreeView.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.TreeView.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    rv = control.Nodes.Add(key, text);
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                rv = control.Nodes.Add(key, text);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return rv;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void AddLine(RichTextBox control, string text)
 | 
					        public static void AddLine(RichTextBox control, string text)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
@ -82,6 +206,52 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void Clear(TreeView control)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() => {
 | 
				
			||||||
 | 
					                    control.Nodes.Clear();
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Nodes.Clear();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void Clear(Label control) => SetText(control, string.Empty);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void Clear(PictureBox control)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    control.Image = null;
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Image = null;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void Clear(DataGridView control)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    control.Rows.Clear();
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Rows.Clear();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static List<T> FindChildControl<T>(Control control) where T : Control
 | 
					        public static List<T> FindChildControl<T>(Control control) where T : Control
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            List<T> rs = new List<T>();
 | 
					            List<T> rs = new List<T>();
 | 
				
			||||||
@ -120,6 +290,21 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
            return rv;
 | 
					            return rv;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void SetEnable(Control control, bool value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    control.Enabled = value;
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Enabled = value;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static int GetValue(NumericUpDown sender)
 | 
					        public static int GetValue(NumericUpDown sender)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            int rv = 0;
 | 
					            int rv = 0;
 | 
				
			||||||
@ -156,38 +341,6 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
            return rv;
 | 
					            return rv;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void SetClear(Label control) => SetText(control, string.Empty);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public static void SetClear(PictureBox control)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                control.Invoke(new MethodInvoker(() =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    control.Image = null;
 | 
					 | 
				
			||||||
                }));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                control.Image = null;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public static void SetClear(DataGridView control)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                control.Invoke(new MethodInvoker(() =>
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    control.Rows.Clear();
 | 
					 | 
				
			||||||
                }));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                control.Rows.Clear();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public static void SetHeight(Control control, int value)
 | 
					        public static void SetHeight(Control control, int value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
@ -261,6 +414,21 @@ namespace RyzStudio.Windows.Forms
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void SetValue(PictureBox control, Image value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Invoke(new MethodInvoker(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    control.Image = value;
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                control.Image = value;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void SetVisible(Control control, bool value)
 | 
					        public static void SetVisible(Control control, bool value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (control.InvokeRequired)
 | 
					            if (control.InvokeRequired)
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user