SimpleShape.BackgroundImageLayoutChanged 事件
,更改,发生形状的 BackgroundImageLayout 属性。
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
<BrowsableAttribute(True)> _
Public Event BackgroundImageLayoutChanged As EventHandler
[BrowsableAttribute(true)]
public event EventHandler BackgroundImageLayoutChanged
[BrowsableAttribute(true)]
public:
event EventHandler^ BackgroundImageLayoutChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member BackgroundImageLayoutChanged : IEvent<EventHandler,
EventArgs>
JScript 不支持事件。
备注
如果通过编程修改或用户交互更改 BackgroundImageLayout 属性,则将引发此事件。
有关如何处理事件的更多信息,请参见使用事件。
示例
下面的示例演示如何在事件处理程序中响应 BackgroundImageLayoutChanged 事件。 此示例要求您具有名为在窗体的 RectangleShape1 的一个 RectangleShape 控件。
Private Sub RectangleShape1_BackgroundImageLayoutChanged(
) Handles RectangleShape1.BackgroundImageLayoutChanged
' If the image is centered, check its size.
If RectangleShape1.BackgroundImageLayout = ImageLayout.Center Then
Dim imageSize As SizeF
imageSize = RectangleShape1.BackgroundImage.PhysicalDimension
' If the image is smaller than the shape, change the BackColor.
If imageSize.Height < RectangleShape1.ClientSize.Height OrElse
imageSize.Width < RectangleShape1.ClientSize.Width Then
RectangleShape1.BackColor = Color.Black
End If
End If
End Sub
private void rectangleShape1_BackgroundImageLayoutChanged(object sender,
System.EventArgs e)
{
// If the image is centered, check its size.
if (rectangleShape1.BackgroundImageLayout == ImageLayout.Center)
{
SizeF imageSize;
imageSize = rectangleShape1.BackgroundImage.PhysicalDimension;
// If the image is smaller than the shape, change the BackColor.
if (imageSize.Height < rectangleShape1.ClientSize.Height ||
imageSize.Width < rectangleShape1.ClientSize.Width)
{
rectangleShape1.BackColor = Color.Black;
}
}
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间
其他资源
Line 和 Shape 控件简介 (Visual Studio)