本文整理汇总了C#中System.Windows.Forms.ListBox.CreateControl方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.CreateControl方法的具体用法?C# ListBox.CreateControl怎么用?C# ListBox.CreateControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListBox
的用法示例。
在下文中一共展示了ListBox.CreateControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HeightAndIntegralHeight
public void HeightAndIntegralHeight ()
{
ListBox a = new ListBox();
Size defaultSize = new Size(120, 96);
Assert.AreEqual (defaultSize, a.Size, "A1");
a.CreateControl();
Assert.AreEqual (0, (a.ClientSize.Height % a.ItemHeight), "A2");
a.IntegralHeight = false;
Assert.AreEqual (a.Size, defaultSize, "A3");
a.IntegralHeight = true;
Assert.AreEqual (0, (a.ClientSize.Height % a.ItemHeight), "A4");
Size clientSizeI = new Size(200, a.ItemHeight * 5);
Size clientSize = clientSizeI + new Size(0, a.ItemHeight / 2);
Size borderSize = new Size(a.Width - a.ClientSize.Width, a.Height - a.ClientSize.Height);
Size totalSizeI = clientSizeI + borderSize;
Size totalSize = clientSize + borderSize;
a = new ListBox();
a.ClientSize = clientSize;
Assert.AreEqual (clientSize, a.ClientSize, "A5");
Assert.AreEqual (totalSize, a.Size, "A6");
a.IntegralHeight = false;
a.IntegralHeight = true;
Assert.AreEqual (clientSize, a.ClientSize, "A7");
a.CreateControl();
Assert.AreEqual (clientSizeI, a.ClientSize, "A8");
Assert.AreEqual (totalSizeI, a.Size, "A9");
a.IntegralHeight = false;
Assert.AreEqual (clientSize, a.ClientSize, "A10");
a.IntegralHeight = true;
Assert.AreEqual (totalSizeI, a.Size, "A11");
a = new ListBox();
a.CreateControl();
a.Size = totalSize;
Assert.AreEqual (totalSizeI, a.Size, "A12");
Assert.AreEqual (clientSizeI, a.ClientSize, "A13");
a.IntegralHeight = false;
Assert.AreEqual (totalSize, a.Size, "A14");
Assert.AreEqual (clientSize, a.ClientSize, "A15");
a = new ListBox();
a.IntegralHeight = false;
Assert.AreEqual (defaultSize, a.Size, "A16");
a.CreateControl();
Assert.AreEqual (defaultSize, a.Size, "A17");
a = new ListBox();
a.ClientSize = clientSize;
a.IntegralHeight = false;
Assert.AreEqual (clientSize, a.ClientSize, "A18");
a.CreateControl();
Assert.AreEqual (clientSize, a.ClientSize, "A19");
}