Rectangle.FromLTRB(Int32, Int32, Int32, Int32) 方法

定義

使用指定的邊緣位置來建立 Rectangle 結構。

public:
 static System::Drawing::Rectangle FromLTRB(int left, int top, int right, int bottom);
public static System.Drawing.Rectangle FromLTRB (int left, int top, int right, int bottom);
static member FromLTRB : int * int * int * int -> System.Drawing.Rectangle
Public Shared Function FromLTRB (left As Integer, top As Integer, right As Integer, bottom As Integer) As Rectangle

參數

left
Int32

這個 Rectangle 結構左上角的 X 座標。

top
Int32

這個 Rectangle 結構左上角的 Y 座標。

right
Int32

這個 Rectangle 結構右下角的 X 座標。

bottom
Int32

這個 Rectangle 結構右下角的 Y 座標。

傳回

這個方法建立的新 Rectangle

範例

下列程式碼範例示範如何使用 方法來建立矩形 FromLTRB 。 此範例的設計目的是要與 Windows Form 搭配使用。 將此程式碼貼到表單中,並在處理表單的事件 Paint 時呼叫 CreateARectangleFromLTRB 方法,並傳遞 ePaintEventArgs

private:
   void CreateARectangleFromLTRB( PaintEventArgs^ e )
   {
      Rectangle myRectangle = Rectangle::FromLTRB( 40, 40, 140, 240 );
      e->Graphics->DrawRectangle( SystemPens::ControlText, myRectangle );
   }
private void CreateARectangleFromLTRB(PaintEventArgs e)
{
    Rectangle myRectangle = Rectangle.FromLTRB(40, 40, 140, 240);
    e.Graphics.DrawRectangle(SystemPens.ControlText, myRectangle);
}
Private Sub CreateARectangleFromLTRB(ByVal e As PaintEventArgs)
    Dim myRectangle As Rectangle = Rectangle.FromLTRB(40, 40, 140, 240)
    e.Graphics.DrawRectangle(SystemPens.ControlText, myRectangle)
End Sub

備註

這個方法會 Rectangle 建立具有指定左上角和右下角的 。

適用於