DataGridViewAutoSizeModeEventArgs.PreviousModeAutoSized Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient une valeur spécifiant si DataGridView a été configuré précédemment pour être redimensionné automatiquement.
public:
property bool PreviousModeAutoSized { bool get(); };
public bool PreviousModeAutoSized { get; }
member this.PreviousModeAutoSized : bool
Public ReadOnly Property PreviousModeAutoSized As Boolean
Valeur de propriété
true
si la propriété AutoSizeRowsMode a pris précédemment des valeurs DataGridViewAutoSizeRowsMode différentes de None ou la propriété RowHeadersWidthSizeMode a pris précédemment des valeurs DataGridViewRowHeadersWidthSizeMode différentes de DisableResizing ou EnableResizing ; sinon, false
.
Exemples
L’exemple de code suivant utilise la PreviousModeAutoSized propriété pour case activée la valeur précédente AutoSizeRowsMode d’un DataGridView. Cet exemple de code fait partie d’un exemple plus large fourni dans How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control.
void WatchRowsModeChanges( Object^ /*sender*/, DataGridViewAutoSizeModeEventArgs^ modeEvent )
{
Label^ label = dynamic_cast<Label^>(flowLayoutPanel1->Controls[ currentLayoutName ]);
if ( modeEvent->PreviousModeAutoSized )
{
label->Text = String::Format( "changed to a different {0}{1}", label->Name, dataGridView1->AutoSizeRowsMode );
}
else
{
label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode );
}
}
private void WatchRowsModeChanges(object sender,
DataGridViewAutoSizeModeEventArgs modeEvent)
{
Label label =
(Label)flowLayoutPanel1.Controls[currentLayoutName];
if (modeEvent.PreviousModeAutoSized)
{
label.Text = "changed to a different " +
label.Name +
dataGridView1.AutoSizeRowsMode.ToString();
}
else
{
label.Text = label.Name +
dataGridView1.AutoSizeRowsMode.ToString();
}
}
Private Sub WatchRowsModeChanges(ByVal sender As Object, _
ByVal modeEvent As DataGridViewAutoSizeModeEventArgs) _
Handles DataGridView1.AutoSizeRowsModeChanged
Dim label As Label = CType(FlowLayoutPanel1.Controls _
(currentLayoutName), Label)
If modeEvent.PreviousModeAutoSized Then
label.Text = "changed to different " & label.Name & _
DataGridView1.AutoSizeRowsMode.ToString()
Else
label.Text = label.Name & _
DataGridView1.AutoSizeRowsMode.ToString()
End If
End Sub
Remarques
La DataGridViewAutoSizeModeEventArgs classe étant utilisée avec les DataGridView.AutoSizeRowsModeChanged événements et DataGridView.RowHeadersWidthSizeModeChanged , cette propriété se rapporte spécifiquement à l’état précédent de la DataGridView.AutoSizeRowsMode propriété ou DataGridView.RowHeadersWidthSizeMode
S’applique à
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour