RectangleFとは? わかりやすく解説

RectangleF コンストラクタ (Single, Single, Single, Single)

指定した位置サイズで、RectangleF クラス新しインスタンス初期化します。

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

Public Sub New ( _
    x As Single, _
    y As Single, _
    width As Single, _
    height As Single _
)
public RectangleF (
    float x,
    float y,
    float width,
    float height
)
public:
RectangleF (
    float x, 
    float y, 
    float width, 
    float height
)
public RectangleF (
    float x, 
    float y, 
    float width, 
    float height
)
public function RectangleF (
    x : float, 
    y : float, 
    width : float, 
    height : float
)

パラメータ

x

四角形左上隅の x 座標

y

四角形左上隅の y 座標

width

四角形の幅。

height

四角形の高さ。

使用例使用例

RectangleF メンバRound メンバ、および Truncate メンバ使用方法を示すコード例次に示します。この例は、Windows フォームでの使用意図してデザインされています。このコードフォーム貼り付けフォームPaint イベント処理するときに PaintEventArgs の e渡して RoundingAndTruncatingRectangles メソッド呼び出します。

Private Sub RoundingAndTruncatingRectangles(
 _
    ByVal e As PaintEventArgs)

    ' Construct a new RectangleF.
    Dim myRectangleF As New
 RectangleF(30.6F, 30.7F, 40.8F, 100.9F)

    ' Call the Round method.
    Dim roundedRectangle As Rectangle = Rectangle.Round(myRectangleF)

    ' Draw the rounded rectangle in red.
    Dim redPen As New Pen(Color.Red,
 4)
    e.Graphics.DrawRectangle(redPen, roundedRectangle)

    ' Call the Truncate method.
    Dim truncatedRectangle As Rectangle = _
        Rectangle.Truncate(myRectangleF)

    ' Draw the truncated rectangle in white.
    Dim whitePen As New
 Pen(Color.White, 4)
    e.Graphics.DrawRectangle(whitePen, truncatedRectangle)

    ' Dispose of the custom pens.
    redPen.Dispose()
    whitePen.Dispose()
End Sub
private void RoundingAndTruncatingRectangles(PaintEventArgs
 e)
{

    // Construct a new RectangleF.
    RectangleF myRectangleF = 
        new RectangleF(30.6F, 30.7F, 40.8F, 100.9F);

    // Call the Round method.
    Rectangle roundedRectangle = Rectangle.Round(myRectangleF);

    // Draw the rounded rectangle in red.
    Pen redPen = new Pen(Color.Red, 4);
    e.Graphics.DrawRectangle(redPen, roundedRectangle);

    // Call the Truncate method.
    Rectangle truncatedRectangle = Rectangle.Truncate(myRectangleF);

    // Draw the truncated rectangle in white.
    Pen whitePen = new Pen(Color.White, 4);
    e.Graphics.DrawRectangle(whitePen, truncatedRectangle);

    // Dispose of the custom pens.
    redPen.Dispose();
    whitePen.Dispose();
}
private:
   void RoundingAndTruncatingRectangles( PaintEventArgs^ e )
   {
      // Construct a new RectangleF.
      RectangleF myRectangleF = RectangleF(30.6F,30.7F,40.8F,100.9F);

      // Call the Round method.
      Rectangle roundedRectangle = Rectangle::Round( myRectangleF );

      // Draw the rounded rectangle in red.
      Pen^ redPen = gcnew Pen( Color::Red,4.0f );
      e->Graphics->DrawRectangle( redPen, roundedRectangle );

      // Call the Truncate method.
      Rectangle truncatedRectangle = Rectangle::Truncate( myRectangleF );

      // Draw the truncated rectangle in white.
      Pen^ whitePen = gcnew Pen( Color::White,4.0f );
      e->Graphics->DrawRectangle( whitePen, truncatedRectangle );

      // Dispose of the custom pens.
      delete redPen;
      delete whitePen;
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RectangleF コンストラクタ (PointF, SizeF)

指定した位置サイズで、RectangleF クラス新しインスタンス初期化します。

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

Public Sub New ( _
    location As PointF, _
    size As SizeF _
)
Dim location As PointF
Dim size As SizeF

Dim instance As New RectangleF(location,
 size)
public RectangleF (
    PointF location,
    SizeF size
)
public:
RectangleF (
    PointF location, 
    SizeF size
)
public RectangleF (
    PointF location, 
    SizeF size
)
public function RectangleF (
    location : PointF, 
    size : SizeF
)

パラメータ

location

四角形領域左上隅を表す PointF。

size

四角形領域の幅と高さを表す SizeF。

使用例使用例

op_Implicit メンバRectangleF メンバ、および op_Equality メンバ使用方法を示すコード例次に示します。この例は、Windows フォームでの使用意図してデザインされています。このコードフォーム貼り付けフォームPaint イベント処理するときに PaintEventArgs の e渡して ConvertRectangleToRectangleF メソッド呼び出します。

Private Sub ConvertRectangleToRectangleF( _
    ByVal e As PaintEventArgs)

    ' Create a rectangle.
    Dim rectangle1 As New
 Rectangle(30, 40, 50, 100)

    ' Convert it to a RectangleF.
    Dim convertedRectangle As RectangleF =
 _
        RectangleF.op_Implicit(rectangle1)

    ' Create a new RectangleF.
    Dim rectangle2 As New
 RectangleF(New PointF(30.0F, 40.0F), _
        New SizeF(50.0F, 100.0F))

    ' Create a custom, partially transparent brush.
    Dim redBrush As New
 SolidBrush(Color.FromArgb(40, Color.Red))

    ' Compare the converted rectangle with the new one.  If they 
    ' are equal, draw and fill the rectangles on the form.
    If (RectangleF.op_Equality(convertedRectangle, rectangle2))
 Then
        e.Graphics.FillRectangle(redBrush, rectangle2)
    End If

    ' Dispose of the custom brush.
    redBrush.Dispose()
End Sub
private void ConvertRectangleToRectangleF(PaintEventArgs
 e)
{

    // Create a rectangle.
    Rectangle rectangle1 = new Rectangle(30, 40, 50, 100);

    // Convert it to a RectangleF.
    RectangleF convertedRectangle = rectangle1;

    // Create a new RectangleF.
    RectangleF rectangle2 = new RectangleF(new
 PointF(30.0F, 40.0F),
        new SizeF(50.0F, 100.0F));

    // Create a custom, partially transparent brush.
    SolidBrush redBrush = new SolidBrush(Color.FromArgb(40, Color.Red));

    // Compare the converted rectangle with the new one.  If they 
    // are equal draw and fill the rectangles on the form.
    if (convertedRectangle == rectangle2)
    {
        e.Graphics.FillRectangle(redBrush, rectangle2);
    }

    // Dispose of the custom brush.
    redBrush.Dispose();
}

private:
   void ConvertRectangleToRectangleF( PaintEventArgs^ e )
   {
      // Create a rectangle.
      Rectangle rectangle1 = Rectangle(30,40,50,100);

      // Convert it to a RectangleF.
      RectangleF convertedRectangle = rectangle1;

      // Create a new RectangleF.
      RectangleF rectangle2 = RectangleF(PointF(30.0F,40.0F),SizeF(50.0F,100.0F));

      // Create a custom, partially transparent brush.
      SolidBrush^ redBrush = gcnew SolidBrush( Color::FromArgb( 40, Color::Red )
 );

      // Compare the converted rectangle with the new one.  If they
 
      // are equal draw and fill the rectangles on the form.
      if ( convertedRectangle == rectangle2 )
      {
         e->Graphics->FillRectangle( redBrush, rectangle2 );
      }

      // Dispose of the custom brush.
      delete redBrush;
   }
};
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RectangleF コンストラクタ


RectangleF フィールド


RectangleF プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Y この RectangleF 構造体左上隅の y 座標取得または設定します
参照参照

関連項目

RectangleF 構造体
System.Drawing 名前空間

RectangleF メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Contains オーバーロードされます指定した点が RectangleF 構造体含まれているかどうか判断します
パブリック メソッド Equals オーバーロードされますオーバーライドされます2 つRectangleF オブジェクト等しかどうか判断します
パブリック メソッド FromLTRB 左上隅および右下隅が指定位置設定されRectangleF 構造体作成します
パブリック メソッド GetHashCode オーバーライドされます。 この RectangleF 構造体ハッシュ コード取得しますハッシュ コード使い方詳細については、Object.GetHashCodeトピック参照してください
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド Inflate オーバーロードされます。 この RectangleF指定の量だけ膨らませます。
パブリック メソッド Intersect オーバーロードされます2 つ四角形交差部分を表す RectangleF 構造体確認します
パブリック メソッド IntersectsWith この四角形rect交差するかどうか判断します
パブリック メソッド Offset オーバーロードされます四角形位置指定した量によって調節します
パブリック メソッド op_Equality 2 つRectangleF 構造体位置およびサイズが同じかどうかテストします
パブリック メソッド op_Implicit 指定した Rectangle 構造体RectangleF 構造体変換します
パブリック メソッド op_Inequality 2 つRectangleF 構造体位置またはサイズ異なかどうかテストします
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString オーバーライドされます。 この RectangleFLocation および Sizeユーザー判読できる文字列変換します
パブリック メソッド Union 和集合形成する 2 つ四角形両方含めることができる最小3 番目の四角形作成します
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

RectangleF 構造体
System.Drawing 名前空間

RectangleF メンバ

四角形位置サイズを表す 4 つ浮動小数点数格納します。より高度な領域関数使用する場合Region オブジェクト使用します

RectangleF データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック フィールドパブリック フィールド
  名前 説明
パブリック フィールド Empty メンバ初期化しない状態で RectangleF クラスインスタンス表します
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Y この RectangleF 構造体左上隅の y 座標取得または設定します
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Contains オーバーロードされます指定した点が RectangleF 構造体含まれているかどうか判断します
パブリック メソッド Equals オーバーロードされますオーバーライドされます2 つRectangleF オブジェクト等しかどうか判断します
パブリック メソッド FromLTRB 左上隅および右下隅が指定位置設定されRectangleF 構造体作成します
パブリック メソッド GetHashCode オーバーライドされます。 この RectangleF 構造体ハッシュ コード取得しますハッシュ コード使い方詳細については、Object.GetHashCodeトピック参照してください
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド Inflate オーバーロードされます。 この RectangleF指定の量だけ膨らませます。
パブリック メソッド Intersect オーバーロードされます2 つ四角形交差部分を表す RectangleF 構造体確認します
パブリック メソッド IntersectsWith この四角形rect交差するかどうか判断します
パブリック メソッド Offset オーバーロードされます四角形位置指定した量によって調節します
パブリック メソッド op_Equality 2 つRectangleF 構造体位置およびサイズが同じかどうかテストします
パブリック メソッド op_Implicit 指定した Rectangle 構造体RectangleF 構造体変換します
パブリック メソッド op_Inequality 2 つRectangleF 構造体位置またはサイズ異なかどうかテストします
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString オーバーライドされます。 この RectangleFLocation および Sizeユーザー判読できる文字列変換します
パブリック メソッド Union 和集合形成する 2 つ四角形両方含めることができる最小3 番目の四角形作成します
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

RectangleF 構造体
System.Drawing 名前空間

RectangleF 構造体

四角形位置サイズを表す 4 つ浮動小数点数格納します。より高度な領域関数使用する場合Region オブジェクト使用します

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

<SerializableAttribute> _
Public Structure RectangleF
[SerializableAttribute] 
public struct RectangleF
[SerializableAttribute] 
public value class RectangleF
/** @attribute SerializableAttribute() */ 
public final class RectangleF extends ValueType
JScript では、構造体使用できますが、新規に宣言することはできません。
解説解説

四角形は幅、高さ、および左上隅で定義します

スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「RectangleF」の関連用語

RectangleFのお隣キーワード
検索ランキング

   

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



RectangleFのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS