SimpleShape.BackgroundImageLayout 属性

更新:2007 年 11 月

获取或设置在 ImageLayout 枚举中定义的背景图像布局。

命名空间:  Microsoft.VisualBasic.PowerPacks
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
<BrowsableAttribute(True)> _
Public Property BackgroundImageLayout As ImageLayout
用法
Dim instance As SimpleShape
Dim value As ImageLayout

value = instance.BackgroundImageLayout

instance.BackgroundImageLayout = value
[BrowsableAttribute(true)]
public ImageLayout BackgroundImageLayout { get; set; }
[BrowsableAttribute(true)]
public:
property ImageLayout BackgroundImageLayout {
    ImageLayout get ();
    void set (ImageLayout value);
}
public function get BackgroundImageLayout () : ImageLayout
public function set BackgroundImageLayout (value : ImageLayout)

属性值

类型:System.Windows.Forms.ImageLayout

ImageLayout 的值(CenterNoneStretchTileZoom)之一。Tile 为默认值。

备注

使用 BackgroundImageLayout 属性可指定添加到控件中的图像的位置和行为。仅在设置了 BackgroundImage 属性时,BackgroundImageLayout 才起作用。

如果将 BackgroundImageLayout 设置为除 Tile 以外的其他值,您可以改善大型图像的性能。

示例

下面的示例演示如何使用 BackgroundImage 和 BackgroundImageLayout 属性在形状上显示图像。此示例要求窗体上有一个名为 OvalShape1 的 OvalShape 控件,并且项目中包含一个名为 Image1 的图像资源。

Private Sub Form1_Load(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles MyBase.Load
    ' Assign an image resource.
    OvalShape1.BackgroundImage = My.Resources.Image1
    ' Resize the image to fit the oval.
    OvalShape1.BackgroundImageLayout = ImageLayout.Stretch
End Sub
private void form1_Load(System.Object sender, System.EventArgs e)
{
    // Assign an image resource.
    ovalShape1.BackgroundImage = SimpleShapeBackGroundImageCS.Properties.Resources.Image1;
    // Resize the image to fit the oval.
    ovalShape1.BackgroundImageLayout = ImageLayout.Stretch;
}

权限

另请参见

参考

SimpleShape 类

SimpleShape 成员

Microsoft.VisualBasic.PowerPacks 命名空间

其他资源

Line 和 Shape 控件简介 (Visual Studio)

如何:使用 LineShape 控件绘制直线 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控件绘制形状 (Visual Studio)

如何:向 Windows 窗体添加背景图像