共用方式為


SimpleShape.BackgroundImageLayout 屬性

取得或設定在 ImageLayout 列舉型別中定義的背景影像配置。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(True)> _
Public Property BackgroundImageLayout As ImageLayout
[BrowsableAttribute(true)]
public ImageLayout BackgroundImageLayout { get; set; }
[BrowsableAttribute(true)]
public:
property ImageLayout BackgroundImageLayout {
    ImageLayout get ();
    void set (ImageLayout value);
}
[<BrowsableAttribute(true)>]
member BackgroundImageLayout : ImageLayout with get, set
function get BackgroundImageLayout () : ImageLayout
function set BackgroundImageLayout (value : ImageLayout)

屬性值

型別:System.Windows.Forms.ImageLayout
One of the values of ImageLayout (Center,None, Stretch, Tile, or Zoom). Tile 是預設值。

備註

使用BackgroundImageLayout屬性,以指定的位置和您加入至控制項之影像的行為。只有在已設定 P:Microsoft.VisualBasic.PowerPacks.SimpleShape.BackgroundImage 屬性時,[BackgroundImageLayout] 才有效。

如果將 BackgroundImageLayout 設定為 Tile 之外的值,則可為大型影像增加效能。

範例

下列範例會示範如何使用BackgroundImage和BackgroundImageLayout屬性,以顯示圖形上的影像。這個範例要求您必須OvalShape控制項在表單上的 OvalShape1 和您的專案包含名為 Image1 影像資源而來。

Private Sub Form1_Load() 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;
}

.NET Framework 安全性

請參閱

參考

SimpleShape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

Line 和 Shape 控制項簡介 (Visual Studio)

HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)

HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)

HOW TO:將背景影像加入至 Windows Form