当前位置: 首页>>代码示例>>C#>>正文


C# Form.GetNextControl方法代码示例

本文整理汇总了C#中System.Windows.Forms.Form.GetNextControl方法的典型用法代码示例。如果您正苦于以下问题:C# Form.GetNextControl方法的具体用法?C# Form.GetNextControl怎么用?C# Form.GetNextControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.GetNextControl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetNextControlComposite

		public void GetNextControlComposite ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ControlPoker a = new ControlPoker ("a");
			ControlPoker b = new ControlPoker ("b");
			ControlPoker c = new ControlPoker ("c");

			form.Controls.Add (a);
			form.Controls.Add (b);
			b.Controls.Add (c);

			form.Show ();

			Assert.AreEqual (form.GetNextControl (a, true), b, "form-1");
			Assert.AreEqual (form.GetNextControl (a, false), null, "form-2");

			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:19,代码来源:FocusTest.cs

示例2: TestPublicMethods

		public void TestPublicMethods ()
		{
			// Public Methods that force Handle creation:
			// - CreateGraphics ()
			// - GetChildAtPoint ()
			// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
			// - PointToClient ()
			// - PointToScreen ()
			// - RectangleToClient ()
			// - RectangleToScreen ()
			// - Select ()
			// - Show (IWin32Window)
			// Notes:
			// - CreateControl does NOT force Handle creation!
			
			Form c = new Form ();

			c.BringToFront ();
			Assert.IsFalse (c.IsHandleCreated, "A1");
			
			c.Contains (new Form ());
			Assert.IsFalse (c.IsHandleCreated, "A2");
			
			c.CreateControl ();
			Assert.IsFalse (c.IsHandleCreated, "A3");
			
			c = new Form ();
			Graphics g = c.CreateGraphics ();
			g.Dispose ();
			Assert.IsTrue (c.IsHandleCreated, "A4");
			c.Dispose ();
			c = new Form ();
			
			c.Dispose ();
			Assert.IsFalse (c.IsHandleCreated, "A5");
			c = new Form ();

			// This is weird, it causes a form to appear that won't go away until you move the mouse over it, 
			// but it doesn't create a handle??
			//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
			//Assert.IsFalse (c.IsHandleCreated, "A6");
			//Assert.AreEqual (DragDropEffects.None, d, "A6b");
			
			//Bitmap b = new Bitmap (100, 100);
			//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
			//Assert.IsFalse (c.IsHandleCreated, "A7");
			//b.Dispose ();
			c.FindForm ();
			Assert.IsFalse (c.IsHandleCreated, "A8");
			
			c.Focus ();
			Assert.IsFalse (c.IsHandleCreated, "A9");

			c.GetChildAtPoint (new Point (10, 10));
			Assert.IsTrue (c.IsHandleCreated, "A10");
			c.Dispose ();
			c = new Form ();
			
			c.GetContainerControl ();
			Assert.IsFalse (c.IsHandleCreated, "A11");
			c.Dispose ();
			
			c = new Form ();
			c.GetNextControl (new Control (), true);
			Assert.IsFalse (c.IsHandleCreated, "A12");
			c.GetPreferredSize (Size.Empty);
			Assert.IsFalse (c.IsHandleCreated, "A13");
			c.Hide ();
			Assert.IsFalse (c.IsHandleCreated, "A14");
			
			c.Invalidate ();
			Assert.IsFalse (c.IsHandleCreated, "A15");
			
			//c.Invoke (new InvokeDelegate (InvokeMethod));
			//Assert.IsFalse (c.IsHandleCreated, "A16");
			c.PerformLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A17");
			
			c.PointToClient (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A18");
			c.Dispose ();
			c = new Form ();
			
			c.PointToScreen (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A19");
			c.Dispose ();
			
			c = new Form ();
			
			//c.PreProcessControlMessage   ???
			//c.PreProcessMessage          ???
			c.RectangleToClient (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A20");
			c.Dispose ();
			c = new Form ();
			c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A21");
			c.Dispose ();
			c = new Form ();
			c.Refresh ();
//.........这里部分代码省略.........
开发者ID:BrzVlad,项目名称:mono,代码行数:101,代码来源:FormHandleTest.cs

示例3: GetNextControlFromTabControl2

		public void GetNextControlFromTabControl2 () {
			Form form = new Form ();
			form.ShowInTaskbar = false;
			TabControl tab = new TabControl ();
			
			TabPage page1 = new TabPage ("page one");
			page1.Controls.AddRange (flat_controls);

			TabPage page2 = new TabPage ("page two");

			tab.TabPages.Add (page1);

			tab.TabPages.Add (page2);

			form.Controls.Add (tab);
			form.Show ();

			Assert.AreEqual (form.GetNextControl (null, true), tab, "form-1");
			Assert.AreEqual (form.GetNextControl (null, false), page2, "form-2");

			Assert.AreEqual (form.GetNextControl (tab, true), page1, "tab-1");
			Assert.AreEqual (form.GetNextControl (tab, false), null, "tab-2");

			Assert.AreEqual (form.GetNextControl (page1, true), flat_controls [0], "page-one-1");
			Assert.AreEqual (form.GetNextControl (page1, false), tab, "page-one-2");

			Assert.AreEqual (form.GetNextControl (page2, true), null, "page-two-1");
			Assert.AreEqual (form.GetNextControl (page2, false), flat_controls [2], "page-two-2");

			Assert.AreEqual (form.GetNextControl (flat_controls [0], false), page1, "form-ctrls-0-backward");
			Assert.AreEqual (form.GetNextControl (flat_controls [2], true), page2, "form-ctrls-2-forward");

			Assert.AreEqual (tab.GetNextControl (null, true), page1, "tab-null-forward");
			Assert.AreEqual (tab.GetNextControl (page1, false), null, "tab-page1-backward");

			Assert.AreEqual (tab.GetNextControl (flat_controls [0], false), page1, "tab-ctrls-0-backward");
			Assert.AreEqual (tab.GetNextControl (flat_controls [2], true), page2, "tab-ctrls-2-forward");

			Assert.AreEqual (page1.GetNextControl (flat_controls [0], true), flat_controls [1], "page1-ctrls-0-forward");
			Assert.AreEqual (page1.GetNextControl (flat_controls [0], false), null, "page1-ctrls-0-backward");
			Assert.AreEqual (page1.GetNextControl (flat_controls [1], true), flat_controls [2], "page1-ctrls-1-forward");
			Assert.AreEqual (page1.GetNextControl (flat_controls [1], false), flat_controls [0], "page1-ctrls-1-backward");
			Assert.AreEqual (page1.GetNextControl (flat_controls [2], true), null, "page1-ctrls-2-forward");
			Assert.AreEqual (page1.GetNextControl (flat_controls [2], false), flat_controls [1],"page1-ctrls-2-backward");
			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:46,代码来源:FocusTest.cs

示例4: GetNextControlDuplicateTabIndex

		public void GetNextControlDuplicateTabIndex ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ControlPoker [] ctrls = new ControlPoker [5];

			for (int i = 0; i < 5; i++) {
				ctrls [i] = new ControlPoker ();
				ctrls [i].TabIndex = i;
				ctrls [i].Text = "ctrl " + i;
			}

			ctrls [3].TabIndex = 2;

			form.Controls.AddRange (ctrls);
			form.Show ();

			Assert.AreEqual (form.GetNextControl (null, true), ctrls [0], "A1");
			Assert.AreEqual (form.GetNextControl (null, false), ctrls [4], "A2");

			Assert.AreEqual (form.GetNextControl (ctrls [0], true), ctrls [1], "A3");
			Assert.AreEqual (form.GetNextControl (ctrls [0], false), null, "A4");

			Assert.AreEqual (form.GetNextControl (ctrls [1], true), ctrls [2], "A5");
			Assert.AreEqual (form.GetNextControl (ctrls [1], false), ctrls [0], "A6");

			Assert.AreEqual (form.GetNextControl (ctrls [2], true), ctrls [3], "A7");
			Assert.AreEqual (form.GetNextControl (ctrls [2], false), ctrls [1], "A8");

			Assert.AreEqual (form.GetNextControl (ctrls [3], true), ctrls [4], "A9");
			Assert.AreEqual (form.GetNextControl (ctrls [3], false), ctrls [2], "A10");

			Assert.AreEqual (form.GetNextControl (ctrls [4], true), null, "A11");
			Assert.AreEqual (form.GetNextControl (ctrls [4], false), ctrls [3], "A12");

			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:37,代码来源:FocusTest.cs

示例5: GetNextGroupBoxControlFlat

		public void GetNextGroupBoxControlFlat ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			GroupBoxPoker gbp = new GroupBoxPoker ("group-box");

			gbp.Controls.AddRange (flat_controls);
			form.Controls.Add (gbp);
			form.Show ();

			Assert.AreEqual (form.GetNextControl (null, true), gbp, "form-1");
			Assert.AreEqual (form.GetNextControl (null, false), flat_controls [2], "form-2");

			Assert.AreEqual (form.GetNextControl (gbp, true), flat_controls [0], "gb-1");
			Assert.AreEqual (form.GetNextControl (gbp, false), null, "gb-2");

			Assert.AreEqual (gbp.GetNextControl (null, true), flat_controls [0], "gb-3");
			Assert.AreEqual (gbp.GetNextControl (null, false), flat_controls [2], "gb-4");
			Assert.AreEqual (gbp.GetNextControl (gbp, true), flat_controls [0], "gb-5");
			Assert.AreEqual (gbp.GetNextControl (gbp, false), flat_controls [2], "gb-6");

			Assert.AreEqual (form.GetNextControl (flat_controls [0], true), flat_controls [1], "form-ctrls-0-forward");
			Assert.AreEqual (form.GetNextControl (flat_controls [0], false), gbp, "form-ctrls-0-backward");
			Assert.AreEqual (form.GetNextControl (flat_controls [1], true), flat_controls [2], "form-ctrls-1-forward");
			Assert.AreEqual (form.GetNextControl (flat_controls [1], false), flat_controls [0], "form-ctrls-1-backward");
			Assert.AreEqual (form.GetNextControl (flat_controls [2], true), null, "form-ctrls-2-forward");
			Assert.AreEqual (form.GetNextControl (flat_controls [2], false), flat_controls [1],"form-ctrls-2-backward");

			Assert.AreEqual (gbp.GetNextControl (flat_controls [0], true), flat_controls [1], "gbp-ctrls-0-forward");
			Assert.AreEqual (gbp.GetNextControl (flat_controls [0], false), null, "gbp-ctrls-0-backward");
			Assert.AreEqual (gbp.GetNextControl (flat_controls [1], true), flat_controls [2], "gbp-ctrls-1-forward");
			Assert.AreEqual (gbp.GetNextControl (flat_controls [1], false), flat_controls [0], "gbp-ctrls-1-backward");
			Assert.AreEqual (gbp.GetNextControl (flat_controls [2], true), null, "gbp-ctrls-2-forward");
			Assert.AreEqual (gbp.GetNextControl (flat_controls [2], false), flat_controls [1],"gbp-ctrls-2-backward");		
			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:36,代码来源:FocusTest.cs

示例6: GetNextControlFromTabControl

		public void GetNextControlFromTabControl ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			TabControl tab = new TabControl ();
			TabPage page1 = new TabPage ("page one");
			TabPage page2 = new TabPage ("page two");

			tab.TabPages.Add (page1);
			tab.TabPages.Add (page2);

			form.Controls.Add (tab);
			form.Show ();

			Assert.AreEqual (form.GetNextControl (null, true), tab, "form-1");
			Assert.AreEqual (form.GetNextControl (null, false), page2, "form-2");

			Assert.AreEqual (form.GetNextControl (tab, true), page1, "tab-1");
			Assert.AreEqual (form.GetNextControl (tab, false), null, "tab-2");

			Assert.AreEqual (form.GetNextControl (page1, true), page2, "page-one-1");
			Assert.AreEqual (form.GetNextControl (page1, false), tab, "page-one-2");

			Assert.AreEqual (form.GetNextControl (page2, true), null, "page-two-1");
			Assert.AreEqual (form.GetNextControl (page2, false), page1, "page-two-2");
			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:27,代码来源:FocusTest.cs

示例7: GetNextControlFlat

		public void GetNextControlFlat ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;

			form.Controls.AddRange (flat_controls);
			form.Show ();

			Assert.AreEqual (form.GetNextControl (null, true), flat_controls [0], "form-1");
			Assert.AreEqual (form.GetNextControl (null, false), flat_controls [2], "form-2");
			Assert.AreEqual (form.GetNextControl (flat_controls [0], true), flat_controls [1], "form-3");
			Assert.AreEqual (form.GetNextControl (flat_controls [0], false), null, "form-4");
			Assert.AreEqual (form.GetNextControl (flat_controls [1], true), flat_controls [2], "form-5");
			Assert.AreEqual (form.GetNextControl (flat_controls [1], false), flat_controls [0], "form-6");
			Assert.AreEqual (form.GetNextControl (flat_controls [2], true), null, "form-7");
			Assert.AreEqual (form.GetNextControl (flat_controls [2], false), flat_controls [1],"form-8");

			
			Assert.AreEqual (flat_controls [0].GetNextControl (null, true), null, "ctrls-0-1");
			Assert.AreEqual (flat_controls [0].GetNextControl (null, false), null, "ctrls-0-2");
			Assert.AreEqual (flat_controls [0].GetNextControl (flat_controls [0], true), null, "ctrls-0-3");
			Assert.AreEqual (flat_controls [0].GetNextControl (flat_controls [0], false), null, "ctrls-0-4");
			Assert.AreEqual (flat_controls [0].GetNextControl (flat_controls [1], true), null, "ctrls-0-5");
			Assert.AreEqual (flat_controls [0].GetNextControl (flat_controls [1], false), null, "ctrls-0-6");
			Assert.AreEqual (flat_controls [0].GetNextControl (flat_controls [2], true), null, "ctrls-0-7");
			Assert.AreEqual (flat_controls [0].GetNextControl (flat_controls [2], false), null,"ctrls-0-8");
			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:28,代码来源:FocusTest.cs

示例8: GetNextControl2FromForm

		public void GetNextControl2FromForm ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ContainerPoker con_a = new ContainerPoker ("container-a");
			ContainerPoker con_b = new ContainerPoker ("container-b");
			ContainerPoker con_c = new ContainerPoker ("container-c");
			
			TestHelper.RemoveWarning (con_b, con_c);
			
			ControlPoker [] ctrls_a = new ControlPoker [] {
				new ControlPoker ("ctrls-a-0"), new ControlPoker ("ctrls-a-1"), new ControlPoker ("ctrls-a-2")
			};
			ControlPoker ctrl_b = new ControlPoker ("ctrl-b");
			
			con_a.Controls.AddRange (ctrls_a);
			
			form.Controls.Add (con_a);
			form.Controls.Add (ctrl_b);

			form.Show ();

			// top level movement, 
			Assert.AreEqual (form.GetNextControl (null, true), con_a, "null-1");
			Assert.AreEqual (form.GetNextControl (null, false), ctrl_b, "null-2");

			Assert.AreEqual (form.GetNextControl (form, true), con_a, "form-1");
			Assert.AreEqual (form.GetNextControl (form, false), ctrl_b, "form-2");

			Assert.AreEqual (form.GetNextControl (con_a, true), ctrl_b, "con-a-1");
			Assert.AreEqual (form.GetNextControl (con_a, false), null, "con-a-2");

			Assert.AreEqual (form.GetNextControl (ctrl_b, true), null, "ctrl-b-1");
			Assert.AreEqual (form.GetNextControl (ctrl_b, false), con_a, "ctrl-b-2");

			Assert.AreEqual (form.GetNextControl (ctrls_a [0], true), ctrls_a [1], "ctrl-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [0], false), con_a, "ctrl-a-2");
			Assert.AreEqual (form.GetNextControl (ctrls_a [1], true), ctrls_a [2], "ctrl-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [1], false), ctrls_a [0], "ctrl-a-2");
			Assert.AreEqual (form.GetNextControl (ctrls_a [2], true), ctrl_b, "ctrl-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [2], false), ctrls_a [1], "ctrl-a-2");
			form.Dispose();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:43,代码来源:FocusTest.cs

示例9: GetNextControlFromForm

		public void GetNextControlFromForm ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ContainerPoker con_a = new ContainerPoker ("container-a");
			ContainerPoker con_b = new ContainerPoker ("container-b");
			ContainerPoker con_c = new ContainerPoker ("container-c");
			ControlPoker [] ctrls_a = new ControlPoker [] {
				new ControlPoker (), new ControlPoker (), new ControlPoker ()
			};
			ControlPoker [] ctrls_b = new ControlPoker [] {
				new ControlPoker (), new ControlPoker (), new ControlPoker ()
			};
			ControlPoker [] ctrls_c = new ControlPoker [] {
				new ControlPoker (), new ControlPoker (), new ControlPoker ()
			};

			con_a.Controls.AddRange (ctrls_a);
			con_b.Controls.AddRange (ctrls_b);
			con_c.Controls.AddRange (ctrls_c);
			
			form.Controls.Add (con_a);
			form.Controls.Add (con_b);
			form.Controls.Add (con_c);

			form.Show ();

			// top level movement, 
			Assert.AreEqual (form.GetNextControl (null, true), con_a, "null-1");
			Assert.AreEqual (form.GetNextControl (null, false), con_c, "null-2");

			Assert.AreEqual (form.GetNextControl (form, true), con_a, "form-1");
			Assert.AreEqual (form.GetNextControl (form, false), con_c, "form-2");
			
			Assert.AreEqual (form.GetNextControl (con_a, true), con_b, "container-1");
			Assert.AreEqual (form.GetNextControl (con_a, false), null, "container-2");
			Assert.AreEqual (form.GetNextControl (con_b, true), con_c, "container-3");
			Assert.AreEqual (form.GetNextControl (con_b, false), con_a, "container-4");
			Assert.AreEqual (form.GetNextControl (con_c, true), null, "container-5");
			Assert.AreEqual (form.GetNextControl (con_c, false), con_b, "container-6");

			Assert.AreEqual (form.GetNextControl (ctrls_a [0], true), ctrls_a [1], "ctrls-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [0], false), con_a, "ctrls-a-2");
			Assert.AreEqual (form.GetNextControl (ctrls_a [1], true), ctrls_a [2], "ctrls-a-3");
			Assert.AreEqual (form.GetNextControl (ctrls_a [1], false), ctrls_a [0], "ctrls-a-4");
			Assert.AreEqual (form.GetNextControl (ctrls_a [2], true), con_b, "ctrls-a-5");
			Assert.AreEqual (form.GetNextControl (ctrls_a [2], false), ctrls_a [1], "ctrls-a-6");

			Assert.AreEqual (form.GetNextControl (ctrls_b [0], true), ctrls_b [1], "ctrls-b-1");
			Assert.AreEqual (form.GetNextControl (ctrls_b [0], false), con_b, "ctrls-b-2");
			Assert.AreEqual (form.GetNextControl (ctrls_b [1], true), ctrls_b [2], "ctrls-b-3");
			Assert.AreEqual (form.GetNextControl (ctrls_b [1], false), ctrls_b [0], "ctrls-b-4");
			Assert.AreEqual (form.GetNextControl (ctrls_b [2], true), con_c, "ctrls-b-5");
			Assert.AreEqual (form.GetNextControl (ctrls_b [2], false), ctrls_b [1], "ctrls-b-6");

			Assert.AreEqual (form.GetNextControl (ctrls_c [0], true), ctrls_c [1], "ctrls-c-1");
			Assert.AreEqual (form.GetNextControl (ctrls_c [0], false), con_c, "ctrls-c-2");
			Assert.AreEqual (form.GetNextControl (ctrls_c [1], true), ctrls_c [2], "ctrls-c-3");
			Assert.AreEqual (form.GetNextControl (ctrls_c [1], false), ctrls_c [0], "ctrls-c-4");
			Assert.AreEqual (form.GetNextControl (ctrls_c [2], true), null, "ctrls-c-5");
			Assert.AreEqual (form.GetNextControl (ctrls_c [2], false), ctrls_c [1], "ctrls-c-6");
			form.Dispose ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:63,代码来源:FocusTest.cs

示例10: GetValue

 public static void GetValue(Form form)
 {
     Control ctrl = null;
     while ((ctrl = form.GetNextControl(ctrl, true)) != null)
         Settings.GetValue(ctrl);
 }
开发者ID:ssoju,项目名称:csharp-webaccessibility,代码行数:6,代码来源:Settings.cs

示例11: SetValue

 public static void SetValue(Form form)
 {
     Control ctl = null;
     while ((ctl = form.GetNextControl(ctl, true)) != null)
     {
         SetValue(ctl);
     }
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:8,代码来源:Settings.cs


注:本文中的System.Windows.Forms.Form.GetNextControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。