Assembly : System.Drawing (dans system.drawing.dll)
Syntaxe<SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Structure Point
Dim instance As Point
[SerializableAttribute] [ComVisibleAttribute(true)] public struct Point
[SerializableAttribute] [ComVisibleAttribute(true)] public value class Point
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ public final class Point extends ValueType
JScript prend en charge l'utilisation de structures mais pas la déclaration de nouvelles structures.
ExempleL'exemple de code suivant crée des points et des tailles à l'aide de plusieurs opérateurs surchargés définis pour ces types. Il montre également comment utiliser la classe SystemPens.
Cet exemple est conçu pour être utilisé avec Windows Forms. Créez un formulaire qui contient un Button nommé subtractButton. Collez le code dans le formulaire et appelez la méthode CreatePointsAndSizes à partir de la méthode de gestion d'événements Paint du formulaire, en passant l'argument e comme PaintEventArgs.
Private Sub CreatePointsAndSizes(ByVal e As PaintEventArgs) ' Create the starting point. Dim startPoint As New Point(subtractButton.Size) ' Use the addition operator to get the end point. Dim endPoint As Point = Point.op_Addition(startPoint, _ New Size(140, 150)) ' Draw a line between the points. e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint) ' Convert the starting point to a size and compare it to the ' subtractButton size. Dim buttonSize As Size = Point.op_Explicit(startPoint) If (Size.op_Equality(buttonSize, subtractButton.Size)) Then ' If the sizes are equal, tell the user. e.Graphics.DrawString("The sizes are equal.", _ New Font(Me.Font, FontStyle.Italic), _ Brushes.Indigo, 10.0F, 65.0F) End If End Sub
private void CreatePointsAndSizes(PaintEventArgs e) { // Create the starting point. Point startPoint = new Point(subtractButton.Size); // Use the addition operator to get the end point. Point endPoint = startPoint + new Size(140, 150); // Draw a line between the points. e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint); // Convert the starting point to a size and compare it to the // subtractButton size. Size buttonSize = (Size)startPoint; if (buttonSize == subtractButton.Size) // If the sizes are equal, tell the user. { e.Graphics.DrawString("The sizes are equal.", new Font(this.Font, FontStyle.Italic), Brushes.Indigo, 10.0F, 65.0F); } }
void CreatePointsAndSizes( PaintEventArgs^ e ) { // Create the starting point. Point startPoint = Point(subtractButton->Size); // Use the addition operator to get the end point. Point endPoint = startPoint + System::Drawing::Size( 140, 150 ); // Draw a line between the points. e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint ); // Convert the starting point to a size and compare it to the // subtractButton size. System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint; if ( buttonSize == subtractButton->Size ) { e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F ); } }
private void CreatePointsAndSizes(PaintEventArgs e) { // Create the starting point. Point startPoint = new Point(subtractButton.get_Size()); // Use the addition operator to get the end point. Point endPoint = Point.op_Addition(startPoint, new Size(140, 150)); // Draw a line between the points. e.get_Graphics().DrawLine(SystemPens.get_Highlight(), startPoint, endPoint); // Convert the starting point to a size and compare it to the // subtractButton size. Size buttonSize = new Size(startPoint); if (buttonSize.Equals(subtractButton.get_Size())) { // If the sizes are equal, tell the user. e.get_Graphics().DrawString("The sizes are equal.", new Font(this.get_Font(), FontStyle.Italic), Brushes.get_Indigo(), 10, 65); } } //CreatePointsAndSizes
Sécurité des threads
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ