更新: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 值 (Center、None、Stretch、Tile 或 Zoom)。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;
}
使用權限
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)
HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)
HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)