ListBox.IntegralHeight 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
부분 항목이 표시되지 않도록 컨트롤의 크기를 조정해야 하는지 여부를 나타내는 값을 가져오거나 설정합니다.
public:
property bool IntegralHeight { bool get(); void set(bool value); };
public bool IntegralHeight { get; set; }
member this.IntegralHeight : bool with get, set
Public Property IntegralHeight As Boolean
속성 값
true컨트롤이 부분 항목을 표시하지 않도록 크기가 조정되면 이고, 그렇지 않으면 . false 기본값은 true입니다.
예제
다음 코드 예제에서는 컨트롤의 HorizontalScrollbar 모든 항목 텍스트를 ListBox 보여 주는 가로 스크롤 막대를 표시 하는 속성 및 HorizontalExtent 사용 하는 방법을 보여 줍니다. 또한 이 예제에서는 속성을 사용하여 IntegralHeight 컨트롤의 ListBox 크기 때문에 항목이 부분적으로 표시되지 않도록 합니다. 이 예제에서는 ListBox 이름이 지정된 listBox1컨트롤을 폼에 추가해야 합니다.
private:
void DisplayHScroll()
{
// Make sure no items are displayed partially.
listBox1->IntegralHeight = true;
// Add items that are wide to the ListBox.
for ( int x = 0; x < 10; x++ )
{
listBox1->Items->Add( String::Format( "Item {0} is a very large value that requires scroll bars", 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.
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( dynamic_cast<String^>(listBox1->Items[ listBox1->Items->Count - 1 ]), listBox1->Font ).Width;
// Set the HorizontalExtent property.
listBox1->HorizontalExtent = hzSize;
}
private void DisplayHScroll()
{
// Make sure no items are displayed partially.
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;
}
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
설명
이 속성이 설정 true되면 컨트롤의 크기가 자동으로 조정되어 항목이 부분적으로 표시되지 않도록 합니다. 양식의 ListBox 공간 요구 사항에 따라 원래 크기를 유지하려면 이 속성을 false으로 설정합니다.
기본적으로 ListBox 크기 및 CheckedListBox 크기는 전체 항목만 표시되도록 합니다. 도킹된 ListBox 영역을 채우거나 CheckedListBox 완전히 채우려면 다음으로 false설정합니다IntegralHeight. 이렇게 하면 컨트롤이 영역을 완전히 채우지만 마지막 항목이 완전히 표시되지는 않습니다.
항목이 ListBox 없으면 이 속성은 영향을 주지 않습니다.
메모
정수 계열 높이는 클라이언트 영역 높이가 ListBox아닌 높이를 기반으로 합니다. 따라서 속성이 IntegralHeight 설정 true되면 스크롤 막대가 표시되는 경우에도 항목이 부분적으로 표시될 수 있습니다.
메모
속성이 DrawMode 설정된 DrawMode.OwnerDrawVariable경우 이 속성은 영향을 주지 않습니다.