Bonjour � tous,

Pour notre logiciel disponible sur notre site http://sites.google.com/site/outilsobdfacile/

Je travaille sur un composant graphique qui simulera un afficheur LCD.. Mais voil� j'experimente quelque soucis de lenteur..

Le principe est le suivant je cr�er un TShape vert et j'ajoute x pixels qui sont eux des TShape (noir) et apr�s je joue sur la propri�t� visible pour afficher du texte. Cel� donne le r�sultat suivant



Uploaded with ImageShack.us

Jusqu'ici tout va bien, vous me direz, sauf que l'affichage initiale du composant prends environ 10s... ET c'est tr�s long 10s sans rien qui se passe pour un programme

Voici le code qui prends un temps fou
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
void __fastcall TForm1::FormCreate(TObject *Sender)
{
   //Create the green background
   TShape *ShapeBack = new TShape(NULL);
   ShapeBack->Parent = Form1;
   ShapeBack->Top = LCD_TOP_POSITION;
   ShapeBack->Left = LCD_LEFT_POSITION;
   ShapeBack->Width = LCD_PIXEL_WIDTH * LCD_PIXEL_DOT;
   ShapeBack->Height = LCD_PIXEL_HEIGHT * LCD_PIXEL_DOT;
   ShapeBack->Brush->Color = LCD_BACK_COLOR;
   //ShapeBack->Visible = TRUE;
 
   //Now create each pixel
   for(int x = 0; x < LCD_PIXEL_WIDTH ; x++)
   {
      for(int y = 0; y < LCD_PIXEL_HEIGHT ; y++)
      {
         Pixels[x][y] = new TShape(NULL);
         Pixels[x][y]->Parent = Form1;
         Pixels[x][y]->Width = LCD_PIXEL_DOT;
         Pixels[x][y]->Height = LCD_PIXEL_DOT;
         Pixels[x][y]->Top = LCD_TOP_POSITION + (y * LCD_PIXEL_DOT);
         Pixels[x][y]->Left = LCD_LEFT_POSITION + (x * LCD_PIXEL_DOT);
         Pixels[x][y]->Brush->Color = LCD_PIXEL_COLOR;
         //Pixels[x][y]->Visible = TRUE;
      }
   }
 
}
La ligne suivante Pixels[x][y]->Parent = Form1; me semble louche mais je suis un pro du C embarqu� et de l'OBD.. mais le C++ je me debrouille, mais sans plus

Je vous remercie d'avance pour votre expertise
Salutations