Export (0) Print
Expand All

Rectangle.FromLTRB Method

Creates a Rectangle structure with the specified edge locations.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public static Rectangle FromLTRB (
	int left,
	int top,
	int right,
	int bottom
)
public static Rectangle FromLTRB (
	int left, 
	int top, 
	int right, 
	int bottom
)
public static function FromLTRB (
	left : int, 
	top : int, 
	right : int, 
	bottom : int
) : Rectangle
Not applicable.

Parameters

left

The x-coordinate of the upper-left corner of this Rectangle structure.

top

The y-coordinate of the upper-left corner of this Rectangle structure.

right

The x-coordinate of the lower-right corner of this Rectangle structure.

bottom

The y-coordinate of the lower-right corner of this Rectangle structure.

Return Value

The new Rectangle that this method creates.

This method creates a Rectangle with the specified upper-left and lower-right corners.

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);
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2015 Microsoft