次の方法で共有


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イベント ハンドラーでイベントです。 この例では、 RectangleShape RectangleShape1 という名前のフォームにコントロールです。

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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

SimpleShape クラス

Microsoft.VisualBasic.PowerPacks 名前空間

その他の技術情報

ライン コントロールとシェイプ コントロールの概要 (Visual Studio)

方法 : LineShape コントロールを使用して線を描画する (Visual Studio)

方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)