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


C# StackPanel.MakeVisible方法代码示例

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


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

示例1: MakeVisible

		public void MakeVisible ()
		{
			StackPanel p = new StackPanel ();
			Rect result = p.MakeVisible (null, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "1 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "2");
			result = p.MakeVisible (null, new Rect (100, 100, 100, 100));
			Assert.AreEqual (p.VerticalOffset, 0, "3 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "3");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "4");
			global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button ();
			p.Children.Add (b);
			result = p.MakeVisible (b, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "5 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "5");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "6");
			ScrollViewer v = new ScrollViewer ();
			v.Content = p;
			result = p.MakeVisible (null, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "7 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "7");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "8");
			result = p.MakeVisible (b, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "9 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "9");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "10");
			v.CanContentScroll = true;
			result = p.MakeVisible (null, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "11 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "11");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "12");
			result = p.MakeVisible (b, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "13 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "13");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "14");
			Window w = new Window ();
			w.Content = v;
			w.Show ();
			result = p.MakeVisible (null, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "15 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "15");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "16");
			result = p.MakeVisible (b, Rect.Empty);
			Assert.AreEqual (p.VerticalOffset, 0, "17 1");
			Assert.IsTrue (double.IsNegativeInfinity (result.Width), "17");
			Assert.IsTrue (double.IsNegativeInfinity (result.Height), "18");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:48,代码来源:StackPanelTest.cs


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