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)
屬性值
型別:System.Drawing.Image
Image ,表示要顯示於圖案的背景影像。
備註
使用BackgroundImage屬性,以將圖形影像放到圖形。
![]() |
---|
Setting the BackgroundImage property overrides any settings for the BackColor, BackStyle, FillColor, FillGradientColor, FillGradientStyle, and FillStyle properties. |
繼承者注意事項
在覆寫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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)
HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)
HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)