Rect.ToString Méthode

Définition

Renvoie une représentation sous forme de chaîne du rectangle.

Surcharges

ToString()

Renvoie une représentation sous forme de chaîne du rectangle.

ToString(IFormatProvider)

Renvoie une représentation sous forme de chaîne du rectangle en utilisant le fournisseur de format spécifié.

ToString()

Renvoie une représentation sous forme de chaîne du rectangle.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Retours

Une représentation sous forme de chaîne du rectangle actuel. La chaîne a la forme suivante : « X,Y,Width,Height ».

Exemples

L’exemple suivant montre comment utiliser la ToString() méthode pour obtenir une représentation sous forme de chaîne d’une Rect structure.

private string toStringExample()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Get a string representation of a Rect structure.
    // rectString is equal to "10,5,200,50"	.
    string rectString = myRectangle.ToString();

    return rectString;
}

S’applique à

ToString(IFormatProvider)

Renvoie une représentation sous forme de chaîne du rectangle en utilisant le fournisseur de format spécifié.

public:
 System::String ^ ToString(IFormatProvider ^ provider);
public string ToString (IFormatProvider provider);
override this.ToString : IFormatProvider -> string
Public Function ToString (provider As IFormatProvider) As String

Paramètres

provider
IFormatProvider

Informations de mise en forme spécifiques à la culture.

Retours

Une représentation sous forme de chaîne du rectangle actuel qui est déterminée par le fournisseur de format spécifié.

S’applique à