TablePattern.TablePatternInformation.ColumnCount Propriété

Définition

Obtient le nombre total de colonnes dans une table.

public:
 property int ColumnCount { int get(); };
public int ColumnCount { get; }
member this.ColumnCount : int
Public ReadOnly Property ColumnCount As Integer

Valeur de propriété

Nombre total de colonnes dans une table. La valeur par défaut est zéro.

Exemples

Dans l’exemple suivant, un TablePattern objet obtenu à partir d’un contrôle cible est passé dans une fonction qui récupère les valeurs de propriété actuelles TablePattern .

///--------------------------------------------------------------------
/// <summary>
/// Gets the current property values from target.
/// </summary>
/// <param name="tablePattern">
/// A TablePattern control pattern obtained from 
/// an automation element representing a target control.
/// </param>
///--------------------------------------------------------------------
private void GetRowColumnCounts(TablePattern tablePattern)
{
    if (tablePattern == null)
    {
        throw new ArgumentException("Target element cannot be null.");
    }

    Console.WriteLine(tablePattern.Current.RowCount.ToString());
    Console.WriteLine(tablePattern.Current.ColumnCount.ToString());
}
'''--------------------------------------------------------------------
''' <summary>
''' Gets the current property values from target.
''' </summary>
''' <param name="tablePattern">
''' A TablePattern control pattern obtained from 
''' an automation element representing a target control.
''' </param>
'''--------------------------------------------------------------------
Private Sub GetRowColumnCounts(ByVal tablePattern As TablePattern)
    If tablePattern Is Nothing Then
        Throw New ArgumentException("Target element cannot be null.")
    End If

    Console.WriteLine(tablePattern.Current.RowCount.ToString())
    Console.WriteLine(tablePattern.Current.ColumnCount.ToString())

End Sub

S’applique à

Voir aussi