Color.Transparent プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Color.Transparent プロパティの意味・解説 

Color.Transparent プロパティ

システム定義色を取得します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

使用例使用例

Transparent プロパティ使用する方法次のコード例示します。この例は、Windows フォームでの使用意図してデザインされています。Button1Button2 という名前の 2 つボタン配置されているフォームコード貼り付けます。フォームコンストラクタUseTransparentProperty メソッド呼び出します。

Private Sub UseTransparentProperty()

    ' Set up the PictureBox to display the entire image, and
    ' to cover the entire client area.
    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    PictureBox1.Dock = DockStyle.Fill

    Try
        ' Set the Image property of the PictureBox to an image retrieved
        ' from the file system.
        PictureBox1.Image = _
            Image.FromFile("C:\Documents and Settings\All Users\"
 _
            & "Documents\My Pictures\Sample Pictures\sunset.jpg")

        ' Set the Parent property of Button1 and Button2 to the 
        ' PictureBox.
        Button1.Parent = PictureBox1
        Button2.Parent = PictureBox1

        ' Set the Color property of both buttons to transparent. 
        ' With this setting, the buttons assume the color of their
        ' parent.
        Button1.BackColor = Color.Transparent
        Button2.BackColor = Color.Transparent

    Catch ex As System.IO.FileNotFoundException
        MessageBox.Show("There was an error." _
        & "Make sure the image file path is valid.")
    End Try


End Sub
private void UseTransparentProperty()
{

    // Set up the PictureBox to display the entire image, and
    // to cover the entire client area.
    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
    PictureBox1.Dock = DockStyle.Fill;

    try
    {
        // Set the Image property of the PictureBox to an image retrieved
        // from the file system.
        PictureBox1.Image = 
            Image.FromFile("C:\\Documents and Settings\\All Users\\" +
            "Documents\\My Pictures\\Sample Pictures\\sunset.jpg");

        // Set the Parent property of Button1 and Button2 to the 
        // PictureBox.
        Button1.Parent = PictureBox1;
        Button2.Parent = PictureBox1;

        // Set the Color property of both buttons to transparent. 
        // With this setting the buttons assume the color of their
        // parent.
        Button1.BackColor = Color.Transparent;
        Button2.BackColor = Color.Transparent;

    }
    catch(System.IO.FileNotFoundException)
    {
        MessageBox.Show("There was an error." +
            "Make sure the image file path is valid.");
    }


}
private:
   void UseTransparentProperty()
   {
      // Set up the PictureBox to display the entire image, and
      // to cover the entire client area.
      PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage;
      PictureBox1->Dock = DockStyle::Fill;
      try
      {
         // Set the Image property of the PictureBox to an image retrieved
         // from the file system.
         PictureBox1->Image = Image::FromFile( "C:\\Documents and Settings\\All
 Users\\"
         "Documents\\My Pictures\\Sample Pictures\\sunset.jpg" );

         // Set the Parent property of Button1 and Button2 to the 
         // PictureBox.
         Button1->Parent = PictureBox1;
         Button2->Parent = PictureBox1;

         // Set the Color property of both buttons to transparent. 
         // With this setting the buttons assume the color of their
         // parent.
         Button1->BackColor = Color::Transparent;
         Button2->BackColor = Color::Transparent;
      }
      catch ( System::IO::FileNotFoundException^ ) 
      {
         MessageBox::Show( "There was an error."
         "Make sure the image file path is valid." );
      }
   }
private void UseTransparentProperty()
{
    // Set up the PictureBox to display the entire image, and
    // to cover the entire client area.
    pictureBox1.set_SizeMode(PictureBoxSizeMode.StretchImage);
    pictureBox1.set_Dock(DockStyle.Fill);
    try {
        // Set the Image property of the PictureBox to an image retrieved
        // from the file system.
        pictureBox1.set_Image(Image.FromFile((
            "C:\\Documents and Settings\\All Users\\" 
            + "Documents\\My Pictures\\Sample Pictures\\sunset.jpg")));

        // Set the Parent property of button1 and button2 to the 
        // PictureBox.
        button1.set_Parent(pictureBox1);
        button2.set_Parent(pictureBox1);

        // Set the Color property of both buttons to transparent. 
        // With this setting the buttons assume the color of their
        // parent.
        button1.set_BackColor(Color.get_Transparent());
        button2.set_BackColor(Color.get_Transparent());
    }
    catch (System.IO.FileNotFoundException exp) {
        MessageBox.Show(("There was an error." 
            + "Make sure the image file path is valid."));
    }
} //UseTransparentProperty
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Color.Transparent プロパティ」の関連用語

Color.Transparent プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Color.Transparent プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS