Size.op_Equality メソッドとは? わかりやすく解説

Size.op_Equality メソッド

2 つSize 構造体等しかどうかテストします

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Shared Operator = ( _
    sz1 As Size, _
    sz2 As Size _
) As Boolean
J# では、オーバーロードされた演算子使用できません。
JScriptでは、 オーバーロードされた演算子使用できますが、新規に宣言することはできません。

パラメータ

sz1

等値演算子左辺にある Size 構造体

sz2

等価演算子右辺にある Size 構造体

戻り値
sz1 および sz2 の幅と高さが等し場合trueそれ以外場合false

使用例使用例

これらの型に対して定義された、オーバーロードされた演算子いくつか使用してポイントサイズ作成するコード例次に示します。この例では、SystemPens クラス使用方法示します

この例は、Windows フォームでの使用意図してデザインされています。subtractButton という名前の Button格納するフォーム作成しますコードフォーム貼り付けフォームPaint イベント処理メソッドから PaintEventArgs の e渡して CreatePointsAndSizes メソッド呼び出します。

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


プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Size.op_Equality メソッド」の関連用語

Size.op_Equality メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Size.op_Equality メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS