|
Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
|
Traduzione
Originale
|
Proprietà ListBox.HorizontalExtent
Spazio dei nomi: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Valore proprietà
Tipo: System.Int32private void DisplayHScroll() { // Make no partial items are displayed vertically. listBox1.IntegralHeight = true; // Add items that are wide to the ListBox. for (int x = 0; x < 10; x++) { listBox1.Items.Add("Item " + x.ToString() + " is a very large value that requires scroll bars"); } // 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. Graphics g = listBox1.CreateGraphics(); // Determine the size for HorizontalExtent using the MeasureString method using the last item in the list. int hzSize = (int) g.MeasureString(listBox1.Items[listBox1.Items.Count -1].ToString(),listBox1.Font).Width; // Set the HorizontalExtent property. listBox1.HorizontalExtent = hzSize; }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (ruoli di base del server non supportati), Windows Server 2008 R2 (ruoli di base del server supportati con SP1 o versione successiva, Itanium non supportato)
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.