Rectangle.FromLTRB(Int32, Int32, Int32, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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
参数
返回
此方法创建的新增 Rectangle 功能。
示例
下面的代码示例演示如何使用 FromLTRB 该方法创建矩形。 此示例旨在与 Windows 窗体一起使用。 将此代码粘贴到窗体中,并在处理表单CreateARectangleFromLTRB的事件时调用Paint该方法,并传递e为 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
注解
此方法使用指定的左上角和右下角创建一个 Rectangle 。