本文整理汇总了C#中System.Windows.Forms.ScrollableControl.ScrollControlIntoView方法的典型用法代码示例。如果您正苦于以下问题:C# ScrollableControl.ScrollControlIntoView方法的具体用法?C# ScrollableControl.ScrollControlIntoView怎么用?C# ScrollableControl.ScrollControlIntoView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ScrollableControl
的用法示例。
在下文中一共展示了ScrollableControl.ScrollControlIntoView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoScrollPositionTest
public void AutoScrollPositionTest ()
{
ScrollableControl sc;
sc = new ScrollableControl ();
sc.AutoScroll = true;
sc.AutoScrollPosition = new Point (-25, -50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#01");
sc.AutoScrollPosition = new Point (2500, 5000);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#02");
sc.AutoScrollPosition = new Point (25, 50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#03");
object o = sc.Handle;
sc.AutoScrollPosition = new Point (-25, -50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#04");
sc.AutoScrollPosition = new Point (2500, 5000);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#05");
sc.AutoScrollPosition = new Point (25, 50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#06");
sc.Size = new Size (200, 400);
sc.Location = new Point (20, 40);
sc.AutoScrollPosition = new Point (-25, -50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#07");
sc.AutoScrollPosition = new Point (2500, 5000);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#08");
sc.AutoScrollPosition = new Point (25, 50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#09");
Control c1, c2;
c1 = new Control ();
c1.Location = new Point (-100, -200);
c1.Size = new Size (10, 10);
sc.Controls.Add (c1);
c2 = new Control ();
c2.Location = new Point (400, 800);
c2.Size = new Size (10, 10);
sc.Controls.Add (c2);
Assert.AreEqual (new Rectangle (0, 0, 410, 810), sc.DisplayRectangle, "#10");
sc.ScrollControlIntoView (c2);
Assert.AreEqual (new Point (-226, -426), sc.AutoScrollPosition, "#11");
Assert.AreEqual (new Rectangle (-226, -426, 410, 810), sc.DisplayRectangle, "#12");
Assert.AreEqual (new Point (-326, -626), c1.Location, "#13");
Assert.AreEqual (new Point (174, 374), c2.Location, "#14");
sc.AutoScrollPosition = new Point (-25, -50);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#01");
Assert.AreEqual (new Rectangle (0, 0, 410, 810), sc.DisplayRectangle, "#15");
Assert.AreEqual (new Point (-100, -200), c1.Location, "#16");
Assert.AreEqual (new Point (400, 800), c2.Location, "#17");
sc.AutoScrollPosition = new Point (2500, 5000);
Assert.AreEqual (new Point (-226, -426), sc.AutoScrollPosition, "#18");
Assert.AreEqual (new Rectangle (-226, -426, 410, 810), sc.DisplayRectangle, "#19");
Assert.AreEqual (new Point (-326, -626), c1.Location, "#20");
Assert.AreEqual (new Point (174, 374), c2.Location, "#21");
sc.AutoScrollPosition = new Point (25, 50);
Assert.AreEqual (new Point (-25, -50), sc.AutoScrollPosition, "#22");
Assert.AreEqual (new Rectangle (-25, -50, 410, 810), sc.DisplayRectangle, "#23");
Assert.AreEqual (new Point (-125, -250), c1.Location, "#24");
Assert.AreEqual (new Point (375, 750), c2.Location, "#25");
sc.ScrollControlIntoView (c1);
Assert.AreEqual (Point.Empty, sc.AutoScrollPosition, "#26");
Assert.AreEqual (new Rectangle (0, 0, 410, 810), sc.DisplayRectangle, "#27");
Assert.AreEqual (new Point (-100, -200), c1.Location, "#28");
Assert.AreEqual (new Point (400, 800), c2.Location, "#29");
sc.AutoScrollPosition = new Point (2500, 5000);
Assert.AreEqual (new Point (-226, -426), sc.AutoScrollPosition, "#30");
Assert.AreEqual (new Rectangle (-226, -426, 410, 810), sc.DisplayRectangle, "#31");
Assert.AreEqual (new Point (-326, -626), c1.Location, "#32");
Assert.AreEqual (new Point (174, 374), c2.Location, "#33");
sc.AutoScrollPosition = new Point (25, 50);
Assert.AreEqual (new Point (-25, -50), sc.AutoScrollPosition, "#34");
Assert.AreEqual (new Rectangle (-25, -50, 410, 810), sc.DisplayRectangle, "#35");
Assert.AreEqual (new Point (-125, -250), c1.Location, "#36");
Assert.AreEqual (new Point (375, 750), c2.Location, "#37");
sc.ScrollControlIntoView (c2);
//.........这里部分代码省略.........