Rectangle.FromLTRB(Int32, Int32, Int32, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a Rectangle structure with the specified edge locations.
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
Parameters
Returns
The new Rectangle that this method creates.
Examples
The following code example demonstrates how to create a rectangle using the FromLTRB method. This example is designed to be used with a Windows Form. Paste this code into a form and call the CreateARectangleFromLTRB
method when handling the form's Paint event, passing e
as PaintEventArgs.
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
Remarks
This method creates a Rectangle with the specified upper-left and lower-right corners.