Rlooping
Messages postés13Date d'inscriptionlundi 28 novembre 2005StatutMembreDernière intervention 2 février 2018
-
25 sept. 2006 à 15:15
P0lO
Messages postés65Date d'inscriptionmercredi 18 avril 2007StatutMembreDernière intervention12 juin 2008
-
8 août 2007 à 16:44
Comment afficher une image dans un picturebox avec transparence ??? Un label transparent sur une image ???
P0lO
Messages postés65Date d'inscriptionmercredi 18 avril 2007StatutMembreDernière intervention12 juin 20081 8 août 2007 à 16:44
Bonjour!
pour afficher une image avec transparence dans le compact framework, le seul moyen à prioris est de l'afficher en utilisant un composant System.Drawing.Graphic ensuite voila une petite fonction maison :P :
public static void DrawImageTransparent(System.Drawing.Graphics g, System.Drawing.Point point, System.Drawing.Bitmap symbol)
{
System.Drawing.Rectangle R = new System.Drawing.Rectangle(point.X - symbol.Width / 2, point.Y - symbol.Height / 2, symbol.Width, symbol.Height);
System.Drawing.Imaging.ImageAttributes attr = new System.Drawing.Imaging.ImageAttributes();
attr.SetColorKey(symbol.GetPixel(0, 0), symbol.GetPixel(0, 0));
g.DrawImage(symbol, R, 0, 0, symbol.Width, symbol.Height, System.Drawing.GraphicsUnit.Pixel, attr);
}
g est la zone graphic sur laquelle ton image doit être déssinée, point contient les coordonnée du centre de l'image à déssiner, symbol est l'image à déssiner,...
"attr.SetColorKey(symbol.GetPixel(0, 0), symbol.GetPixel(0, 0));" c'est ici que tu va rendre la couleur de choix transparente à l'affichage, ici on prend arbitrairement comme couleur à rendre transparente la couleur du pixel de coordonnées x=0 et y=0.