ButtonBase.Image プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

[LocalizableAttribute(true)] public: property Image^ Image { Image^ get (); void set (Image^ value); }
ボタン コントロールに表示される Image。既定値は null 参照 (Visual Basic では Nothing) です。

Image プロパティが設定されている場合は、ImageList プロパティは null 参照 (Visual Basic では Nothing) に設定され、ImageIndex プロパティは既定値 -1 に設定されます。
![]() |
---|
FlatStyle プロパティが FlatStyle.System に設定されている場合、Image プロパティに割り当てられているイメージは表示されません。 |

派生クラス Button を使用して、その共通プロパティの一部を設定するコード例を次に示します。結果として、テキストを左側、イメージを右側に含むフラットなボタンが表示されます。このコードでは、C:\Graphics ディレクトリに MyBitMap.bmp という名前のビットマップ イメージが格納されており、System.Drawing 名前空間への参照がコードに含まれている必要があります。
Private Sub SetMyButtonProperties() ' Assign an image to the button. button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp") ' Align the image and text on the button. button1.ImageAlign = ContentAlignment.MiddleRight button1.TextAlign = ContentAlignment.MiddleLeft ' Give the button a flat appearance. button1.FlatStyle = FlatStyle.Flat End Sub 'SetMyButtonProperties
private void SetMyButtonProperties() { // Assign an image to the button. button1.Image = Image.FromFile("C:\\Graphics\\MyBitmap.bmp"); // Align the image and text on the button. button1.ImageAlign = ContentAlignment.MiddleRight; button1.TextAlign = ContentAlignment.MiddleLeft; // Give the button a flat appearance. button1.FlatStyle = FlatStyle.Flat; }
private: void SetMyButtonProperties() { // Assign an image to the button. button1->Image = Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" ); // Align the image and text on the button. button1->ImageAlign = ContentAlignment::MiddleRight; button1->TextAlign = ContentAlignment::MiddleLeft; // Give the button a flat appearance. button1->FlatStyle = FlatStyle::Flat; }
private void SetMyButtonProperties() { // Assign an image to the button. button1.set_Image(Image.FromFile("C:\\Graphics\\MyBitmap.bmp")); // Align the image and text on the button. button1.set_ImageAlign(ContentAlignment.MiddleRight); button1.set_TextAlign(ContentAlignment.MiddleLeft); // Give the button a flat appearance. button1.set_FlatStyle(FlatStyle.Flat); } //SetMyButtonProperties
private function SetMyButtonProperties() { // Assign an image to the button. button1.Image = Image.FromFile("C:\\Graphics\\MyBitmap.bmp"); // Align the image and text on the button. button1.ImageAlign = ContentAlignment.MiddleRight; button1.TextAlign = ContentAlignment.MiddleLeft; // Give the button a flat appearance. button1.FlatStyle = FlatStyle.Flat; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からButtonBase.Image プロパティを検索する場合は、下記のリンクをクリックしてください。

- ButtonBase.Image プロパティのページへのリンク