DataGridViewImageCellLayout Wyliczenie
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Określa układ obrazu zawartego w obiekcie DataGridViewCell.
public enum class DataGridViewImageCellLayout
public enum DataGridViewImageCellLayout
type DataGridViewImageCellLayout =
Public Enum DataGridViewImageCellLayout
- Dziedziczenie
Nazwa | Wartość | Opis |
---|---|---|
Normal | 1 | Grafika jest wyświetlana wyśrodkowana przy użyciu natywnej rozdzielczości. |
NotSet | 0 | Nie ustawiono specyfikacji układu. |
Stretch | 2 | Grafika jest rozciągana o wartości procentowe wymagane do dopasowania szerokości i wysokości zawierającej komórki. |
Zoom | 3 | Grafika jest równomiernie powiększona, dopóki nie wypełni szerokości lub wysokości komórki zawierającej. |
Poniższy przykład kodu ilustruje użycie tego typu. Ten przykład jest częścią większego przykładu dostępnego w temacie How to: Work with Image Columns in the Windows Forms DataGridView Control (Jak pracować z kolumnami obrazów w kontrolce DataGridView).
void Stretch( Object^ sender, EventArgs^ e )
{
System::Collections::IEnumerator^ myEnum = dataGridView1->Columns->GetEnumerator();
while ( myEnum->MoveNext() )
{
DataGridViewImageColumn^ column = safe_cast<DataGridViewImageColumn^>(myEnum->Current);
column->ImageLayout = DataGridViewImageCellLayout::Stretch;
column->Description = L"Stretched";
}
}
void ZoomToImage( Object^ sender, EventArgs^ e )
{
System::Collections::IEnumerator^ myEnum1 = dataGridView1->Columns->GetEnumerator();
while ( myEnum1->MoveNext() )
{
DataGridViewImageColumn^ column = safe_cast<DataGridViewImageColumn^>(myEnum1->Current);
column->ImageLayout = DataGridViewImageCellLayout::Zoom;
column->Description = L"Zoomed";
}
}
void NormalImage( Object^ sender, EventArgs^ e )
{
System::Collections::IEnumerator^ myEnum2 = dataGridView1->Columns->GetEnumerator();
while ( myEnum2->MoveNext() )
{
DataGridViewImageColumn^ column = safe_cast<DataGridViewImageColumn^>(myEnum2->Current);
column->ImageLayout = DataGridViewImageCellLayout::Normal;
column->Description = L"Normal";
}
}
private void Stretch(object sender, EventArgs e)
{
foreach (DataGridViewImageColumn column in
dataGridView1.Columns)
{
column.ImageLayout = DataGridViewImageCellLayout.Stretch;
column.Description = "Stretched";
}
}
private void ZoomToImage(object sender, EventArgs e)
{
foreach (DataGridViewImageColumn column in
dataGridView1.Columns)
{
column.ImageLayout = DataGridViewImageCellLayout.Zoom;
column.Description = "Zoomed";
}
}
private void NormalImage(object sender, EventArgs e)
{
foreach (DataGridViewImageColumn column in
dataGridView1.Columns)
{
column.ImageLayout = DataGridViewImageCellLayout.Normal;
column.Description = "Normal";
}
}
Private Sub Stretch(ByVal sender As Object, _
ByVal e As EventArgs) Handles Button3.Click
For Each column As DataGridViewImageColumn _
In dataGridView1.Columns
column.ImageLayout = DataGridViewImageCellLayout.Stretch
column.Description = "Stretched image layout"
Next
End Sub
Private Sub ZoomToImage(ByVal sender As Object, _
ByVal e As EventArgs) Handles Button4.Click
For Each column As DataGridViewImageColumn _
In dataGridView1.Columns
column.ImageLayout = DataGridViewImageCellLayout.Zoom
column.Description = "Zoomed image layout"
Next
End Sub
Private Sub NormalImage(ByVal sender As Object, _
ByVal e As EventArgs) Handles Button5.Click
For Each column As DataGridViewImageColumn _
In dataGridView1.Columns
column.ImageLayout = DataGridViewImageCellLayout.Normal
column.Description = "Normal image layout"
Next
End Sub
Produkt | Wersje |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Opinia o produkcie .NET
.NET to projekt typu open source. Wybierz link, aby przekazać opinię: