Here are the examples of the csharp api class System.Windows.Forms.Application.GetRootControl(Control) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
0
1. Example
Project: Unity-WinForms
Source File: Application.cs
Source File: Application.cs
internal static Control GetRootControl(Control control) { if (control == null) return null; if (control.Parent != null) return GetRootControl(control.Parent); return control; }
0
2. Example
Project: Unity-WinForms
Source File: Application.cs
Source File: Application.cs
internal static void NextTabControl(Control control) { var controlForm = GetRootControl(control) as Form; if (controlForm == null || controlForm.Controls.Count <= 0) return; var formControls = new List<Control>(); _FillListWithVisibleControls(controlForm, formControls); var possibleControls = formControls.FindAll(x => x.IsDisposed == false && x.CanSelect && x.TabStop); if (possibleControls.Count == 0) return; possibleControls.Sort(TabComparison); int controlIndex = possibleControls.FindIndex(x => x == control); var nextControlIndex = controlIndex + 1; if (nextControlIndex >= possibleControls.Count) nextControlIndex = 0; possibleControls[nextControlIndex].Focus(); }
0
3. Example
Project: Unity-WinForms
Source File: Application.cs
Source File: Application.cs
internal static void PrevTabControl(Control control) { var controlForm = GetRootControl(control) as Form; if (controlForm == null || controlForm.Controls.Count <= 0) return; var formControls = new List<Control>(); _FillListWithVisibleControls(controlForm, formControls); var possibleControls = formControls.FindAll(x => x.Visible && x.IsDisposed == false && x.CanSelect && x.TabStop); if (possibleControls.Count == 0) return; possibleControls.Sort(TabComparison); int controlIndex = possibleControls.FindIndex(x => x == control); var nextControlIndex = controlIndex - 1; if (nextControlIndex < 0) nextControlIndex = possibleControls.Count - 1; possibleControls[nextControlIndex].Focus(); }