本文整理汇总了C#中System.Windows.Forms.TabControl.CreateControl方法的典型用法代码示例。如果您正苦于以下问题:C# TabControl.CreateControl方法的具体用法?C# TabControl.CreateControl怎么用?C# TabControl.CreateControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TabControl
的用法示例。
在下文中一共展示了TabControl.CreateControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemSizeTest
public void ItemSizeTest ()
{
TabControl tc = new TabControl ();
Assert.AreEqual (Size.Empty, tc.ItemSize, "#A0");
tc.CreateControl ();
Assert.IsTrue (tc.ItemSize.Width == 0, "#B0");
Assert.IsTrue (tc.ItemSize.Height > 0, "#B1");
tc.TabPages.Add ("A");
Assert.IsTrue (tc.ItemSize.Width > 0, "#C0");
Assert.IsTrue (tc.ItemSize.Height > 0, "#C1");
// ItemSize.Height can change, depending on Font
Size prev_size = tc.ItemSize;
tc.Font = new Font (tc.Font.FontFamily, tc.Font.Height * 2);
Assert.IsTrue (tc.ItemSize.Height > prev_size.Height, "#D0");
// Images can cause a change as well
prev_size = tc.ItemSize;
ImageList image_list = new ImageList ();
image_list.ImageSize = new Size (image_list.ImageSize.Width, tc.Font.Height * 2);
tc.ImageList = image_list;
Assert.IsTrue (tc.ItemSize.Height > prev_size.Height, "#E0");
}
示例2: ItemSizeFixedTest
public void ItemSizeFixedTest ()
{
TabControl tc = new TabControl ();
tc.SizeMode = TabSizeMode.Fixed;
Assert.AreEqual (Size.Empty, tc.ItemSize, "#A0");
tc.CreateControl ();
Assert.IsTrue (tc.ItemSize.Width == 0, "#B0");
Assert.IsTrue (tc.ItemSize.Height > 0, "#B1");
tc.TabPages.Add ("A");
Assert.IsTrue (tc.ItemSize.Width == 96, "#C0");
Assert.IsTrue (tc.ItemSize.Width > 0, "#C1");
// Height can change automatically depending on Font,
// but not Width
Size prev_size = tc.ItemSize;
tc.Font = new Font (tc.Font.FontFamily, tc.Font.Height * 2);
Assert.IsTrue (tc.ItemSize.Width == 96, "#D0");
Assert.IsTrue (tc.ItemSize.Height > prev_size.Height, "#D1");
// Manually set ItemSize
tc.ItemSize = new Size (100, 35);
Assert.AreEqual (100, tc.ItemSize.Width, "#E0");
Assert.AreEqual (35, tc.ItemSize.Height, "#E1");
// Font size is decreased, but since we manually set
// the size we can't automatically update it.
tc.Font = new Font (tc.Font.FontFamily, tc.Font.Height / 2);
Assert.AreEqual (100, tc.ItemSize.Width, "#F0");
Assert.AreEqual (35, tc.ItemSize.Height, "#F1");
// Manually set even if control has not been created.
tc = new TabControl ();
tc.SizeMode = TabSizeMode.Fixed;
tc.ItemSize = new Size (100, 35);
Assert.AreEqual (100, tc.ItemSize.Width, "#G0");
Assert.AreEqual (35, tc.ItemSize.Height, "#G1");
}
示例3: ItemSizeTestPadding
public void ItemSizeTestPadding ()
{
TabControl tc = new TabControl ();
tc.TabPages.Add ("One"); // Need to add a page to force to calc the width
tc.CreateControl (); // And create the control as well
Assert.IsTrue (tc.ItemSize != Size.Empty, "#A0");
Size item_size = tc.ItemSize;
tc.Padding = new Point (tc.Padding.X * 2, tc.Padding.Y * 2);
Assert.IsTrue (tc.ItemSize.Height > item_size.Height, "#B0");
Assert.IsTrue (tc.ItemSize.Width > item_size.Width, "#B1");
}