Rect.ToString Méthode

Définition

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

Surcharges

Nom Description
ToString()

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

ToString(IFormatProvider)

Retourne une représentation sous forme de chaîne du rectangle à l’aide du fournisseur de format spécifié.

ToString()

Retourne 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

Représentation sous forme de chaîne du rectangle actuel. La chaîne a la forme suivante : «X ,YWidth ,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)

Retourne une représentation sous forme de chaîne du rectangle à l’aide du 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 propres à la culture.

Retours

Représentation sous forme de chaîne du rectangle actuel déterminé par le fournisseur de format spécifié.

S’applique à