DataGrid.PreferredColumnWidth Propriedade

Definição

Obtém ou define a largura padrão das colunas da grelha em pixels.

public:
 property int PreferredColumnWidth { int get(); void set(int value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.DataGridPreferredColumnWidthTypeConverter))]
public int PreferredColumnWidth { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.DataGridPreferredColumnWidthTypeConverter))>]
member this.PreferredColumnWidth : int with get, set
Public Property PreferredColumnWidth As Integer

Valor de Propriedade

A largura padrão (em píxeis) das colunas na grelha.

Atributos

Exceções

O valor da propriedade é inferior a 0.

Exemplos

O exemplo de código seguinte define as larguras padrão das colunas para um valor passado ao método.

Private Sub SetDefaultColWidth(defColWidth As Integer)
    DataGrid1.PreferredColumnWidth = defColWidth
 End Sub

Observações

Defina esta propriedade antes de redefinir as DataSource propriedades and DataMember (separadamente ou através do SetDataBinding método), caso contrário a propriedade não terá efeito.

A propriedade não pode ser definida para um valor inferior a 0.

Aplica-se a

Ver também