本文整理汇总了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");
}