共用方式為


SimpleShape.BackgroundImage 屬性

取得或設定顯示在圖形中的影像。

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

語法

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

屬性值

類型:Image
Image ,代表要顯示在圖形的背景影像。

備註

使用BackgroundImage將圖形影像放圖形的屬性。

注意事項注意事項

設定BackgroundImage屬性會覆寫任何設定BackColorBackStyleFillColorFillGradientColorFillGradientStyle,和FillStyle屬性。

繼承者注意事項

在覆寫BackgroundImage屬性在衍生類別中,使用BackgroundImage擴充基底實作的基底類別的屬性。 否則,您必須提供所有的實作。 您不需要覆寫這兩個 get 和 set 存取子BackgroundImage的屬性。如果您需要,您可以取代只有一個。

範例

下列範例示範如何使用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)

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

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

如何:將背景影像加入至 Windows Form