本文整理匯總了C#中System.Windows.Forms.FlowLayoutPanel.GetPreferredSize方法的典型用法代碼示例。如果您正苦於以下問題:C# FlowLayoutPanel.GetPreferredSize方法的具體用法?C# FlowLayoutPanel.GetPreferredSize怎麽用?C# FlowLayoutPanel.GetPreferredSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.FlowLayoutPanel
的用法示例。
在下文中一共展示了FlowLayoutPanel.GetPreferredSize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PreferredSize
public void PreferredSize ()
{
FlowLayoutPanel panel = new FlowLayoutPanel ();
panel.Controls.AddRange (new Control [] { new PreferredSizeControl (), new PreferredSizeControl () });
Assert.AreEqual (new Size (212, 106), panel.PreferredSize, "1");
Assert.AreEqual (new Size (106, 212), panel.GetPreferredSize (new Size (150, 150)), "2");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (1000, 1000)) , "3");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (0, 0)), "4");
Assert.AreEqual (new Size (106, 212), panel.GetPreferredSize (new Size (1, 1)), "5");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (0, 150)), "6");
Assert.AreEqual (new Size (106, 212), panel.GetPreferredSize (new Size (150, 0)), "7");
panel.WrapContents = false;
Assert.AreEqual (new Size (212, 106), panel.PreferredSize, "1, WrapContents");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (150, 150)), "2, WrapContents");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (1000, 1000)) , "3, WrapContents");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (0, 0)), "4, WrapContents");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (1, 1)), "5, WrapContents");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (0, 150)), "6, WrapContents");
Assert.AreEqual (new Size (212, 106), panel.GetPreferredSize (new Size (150, 0)), "7, WrapContents");
}