當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET ListBox.IntegralHeight屬性代碼示例

本文整理匯總了VB.NET中System.Windows.Forms.ListBox.IntegralHeight屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET ListBox.IntegralHeight屬性的具體用法?VB.NET ListBox.IntegralHeight怎麽用?VB.NET ListBox.IntegralHeight使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在System.Windows.Forms.ListBox的用法示例。


在下文中一共展示了ListBox.IntegralHeight屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: DisplayHScroll

Private Sub DisplayHScroll()
     ' Make sure no items are displayed partially.
   listBox1.IntegralHeight = True
   Dim x As Integer

   ' Add items that are wide to the ListBox.
   For x = 0 To 10
      listBox1.Items.Add("Item  " + x.ToString() + " is a very large value that requires scroll bars")
   Next x

   ' Display a horizontal scroll bar.
   listBox1.HorizontalScrollbar = True

   ' Create a Graphics object to use when determining the size of the largest item in the ListBox.
   Dim g As System.Drawing.Graphics = listBox1.CreateGraphics()


   ' Determine the size for HorizontalExtent using the MeasureString method using the last item in the list.
   Dim hzSize As Integer = g.MeasureString(listBox1.Items(listBox1.Items.Count - 1).ToString(), listBox1.Font).Width
   ' Set the HorizontalExtent property.
   listBox1.HorizontalExtent = hzSize
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Windows.Forms,代碼行數:22,代碼來源:ListBox.IntegralHeight


注:本文中的System.Windows.Forms.ListBox.IntegralHeight屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。