jesaipa_1
Messages postés63Date d'inscriptiondimanche 8 janvier 2006StatutMembreDernière intervention16 mai 2007
-
13 janv. 2006 à 16:52
cs_RMI
Messages postés305Date d'inscriptionvendredi 18 juillet 2003StatutMembreDernière intervention 2 août 2010
-
16 janv. 2006 à 11:30
Slt à tous, je suis dans une galère pas possible avec mon stage
je boss sur du c# pour la première fois.
Pour mon projet je dois chargé 12 images .GIF mais sa mais tro de temps a chargé j'ai essayer d'améliorer ce temps avec des threads mais je vois pas le gain de temps a moins que c moi qui c'est mal les utiliser
je voudrais savoir qu'est-ce que je pourrait faire pour accélérer le temps de téléchargement
(PS : euh d'apres moi je pense pas que c'est le chargement des images mais plutot ma fonction qui analyse les images pixel par pixel )
jesaipa_1
Messages postés63Date d'inscriptiondimanche 8 janvier 2006StatutMembreDernière intervention16 mai 2007 16 janv. 2006 à 11:19
ton idée m'interress bcp mais franchement moi et l'anglais sa fait pa 1 mais pluto 2.
J'aimerais vraimen multiplié mes performances par 10
Je te laiss regarder le code que j'utilise pour ma class dérivé de la class panel
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Dernier
{
public class myPanel : System.Windows.Forms.Panel
{
private const int WM_NCHITTEST = 0x84;
public myPanel(String _nom, int _larg, int _lon)
: base()
{
String nom = _nom;
int larg = _larg;
int lon = _lon;
// Utilise le premier pixel comme couleur transparente.
String path = "C:\\Documents and Settings\\ecaya\\Mes documents\\Mes images\\final\\gif\" + nom;
this.Location = new System.Drawing.Point(larg, lon);
Bitmap bmp = new Bitmap(path);
Color key = bmp.GetPixel(0, 0);
// Alt + F4 pour quitter.
this.ClientSize = bmp.Size;
this.BackgroundImage = bmp;
this.Region = MakeRegionFromBitmap(bmp, key);
}
// Bitmap sans compression avec une couleur de fond unique !
// On peut utiliser Bitmap.LockBits pour accélérer le traitement.
private Region MakeRegionFromBitmap(Bitmap bitmap, Color transparency)
{
if (bitmap == null)
throw new ArgumentNullException();
int width = bitmap.Width;
int height = bitmap.Height;
GraphicsPath path = new GraphicsPath();
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
if (bitmap.GetPixel(x, y) != transparency)
{
path.AddRectangle(new Rectangle(x, y, 1, 1));
}
}
}
Region region = new Region(path);
path.Dispose();
path = null;
return region;
}
}
}
Si tu comprend ce code et que tu pense pouvoir m'aider sa me ferai grav plaisir
Merci
Vous n’avez pas trouvé la réponse que vous recherchez ?