Color.Transparent, propriété (System.Drawing)

Bibliothèque de classes .NET Framework 
Color.Transparent, propriété 

Obtient une couleur définie par le système.

Espace de noms : System.Drawing
Assembly : System.Drawing (dans system.drawing.dll)

SyntaxeSyntaxe


Visual Basic (Déclaration)
Public Shared ReadOnly Property Transparent As Color


Visual Basic (Utilisation)
Dim value As Color

value = Color.Transparent


C#
public static Color Transparent { get; }


C++
public:
static property Color Transparent {
    Color get ();
}


J#
/** @property */
public static Color get_Transparent ()


JScript
public static function get Transparent () : Color

Valeur de la propriété

Color représentant une couleur définie par le système.
ExempleExemple

L'exemple de code suivant montre comment utiliser la propriété Transparent. Cet exemple est conçu pour être utilisé avec Windows Forms. Collez le code dans un formulaire qui contient deux boutons nommés Button1 et Button2. Appelez la méthode UseTransparentProperty dans le constructeur du formulaire.



Visual Basic
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


C#
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.");
    }


}


C++
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." );
      }
   }


J#
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
Plates-formesPlates-formes

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.

Informations de versionInformations de version

.NET Framework

Prise en charge dans : 2.0, 1.1, 1.0

.NET Compact Framework

Prise en charge dans : 2.0, 1.0
Voir aussiVoir aussi

Ces informations proviennent du site de http://msdn2.microsoft.com
Source de cette page : http://msdn2.microsoft.com/fr-fr/library/system.drawing.color.transparent.aspx

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

9 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-6432
Document créé le 30/10/06 03:24, dernière modification le Vendredi 17 Juin 2011, 12:11
Source du document imprimé : http://www.gaudry.be/dotnet-rf-system.drawing.color.transparent.html Document affiché 8 fois ce mois de Mai.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,44 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Pensez qu'il y a un million de singes derrière un million de claviers, mais n'imaginez pas que les forums aient quoi que ce soit de comparable avec Shakespeare.

Blair Houghton
 
l'infobrol
Nous sommes le Jeudi 31 Mai 2012, 23:13, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)