Rectangle.FromLTRB(Int32, Int32, Int32, Int32) Método
Definição
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
Parâmetros
- left
- Int32
A coordenada X do canto superior esquerdo da estrutura de Rectangle.The x-coordinate of the upper-left corner of this Rectangle structure.
- top
- Int32
A coordenada Y do canto superior esquerdo dessa estrutura Rectangle.The y-coordinate of the upper-left corner of this Rectangle structure.
- right
- Int32
A coordenada X do canto inferior direito dessa estrutura Rectangle.The x-coordinate of the lower-right corner of this Rectangle structure.
- bottom
- Int32
A coordenada Y do canto inferior direito dessa estrutura Rectangle.The y-coordinate of the lower-right corner of this Rectangle structure.
Retornos
O novo Rectangle criado por esse método.The new Rectangle that this method creates.
Exemplos
O exemplo de código a seguir demonstra como criar um retângulo usando o FromLTRB método.The following code example demonstrates how to create a rectangle using the FromLTRB method. Este exemplo foi projetado para ser usado com um Windows Form.This example is designed to be used with a Windows Form. Cole esse código em um formulário e chame o CreateARectangleFromLTRB método ao manipular o evento do formulário Paint , passando e como PaintEventArgs .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
Comentários
Esse método cria um Rectangle com os cantos superior esquerdo e inferior direito especificados.This method creates a Rectangle with the specified upper-left and lower-right corners.