Label.CalcImageRenderBounds(Image, Rectangle, ContentAlignment) Method

Definition

根据控件的对齐方式,确定在 Label 控件中绘制的图像的大小和位置。Determines the size and location of an image drawn within the Label control based on the alignment of the control.

protected:
 System::Drawing::Rectangle CalcImageRenderBounds(System::Drawing::Image ^ image, System::Drawing::Rectangle r, System::Drawing::ContentAlignment align);
protected System.Drawing.Rectangle CalcImageRenderBounds (System.Drawing.Image image, System.Drawing.Rectangle r, System.Drawing.ContentAlignment align);
member this.CalcImageRenderBounds : System.Drawing.Image * System.Drawing.Rectangle * System.Drawing.ContentAlignment -> System.Drawing.Rectangle
Protected Function CalcImageRenderBounds (image As Image, r As Rectangle, align As ContentAlignment) As Rectangle

Parameters

image
Image

在控件中绘制时,Image 用于确定大小和位置。The Image used to determine size and location when drawn within the control.

r
Rectangle

Rectangle 表示绘制图像的区域。A Rectangle that represents the area to draw the image in.

align
ContentAlignment

控件中内容的对齐方式。The alignment of content within the control.

Returns

Rectangle

Rectangle,表示控件内指定图像的大小和位置。A Rectangle that represents the size and location of the specified image within the control.

Remarks

可以在 Label的派生类中使用此方法,以根据控件在控件中的位置来确定要在 Label 控件中绘制的图像的大小和位置。You can use this method within a derived class of Label, to determine the size and location of an image to draw within the Label control based on its location within the control. 图像的位置基于控件的 ImageAlign 属性的值。The location of the image is based on the value of the control's ImageAlign property.

Applies to

See also