Utilisateur anonyme
-
27 juil. 2007 à 01:27
Utilisateur anonyme -
7 août 2007 à 11:17
Salut à tous,
Je viens de faire une découverte pas très rigolote .
Imaginez que vous avez un TStringGrid contenant 10 lignes dont 3 sont visibles à l'écran et les autres uniquement en utilisant les scrollbar.
Imaginez maintenant que vous incorporez via l'évenement OnDrawCell, 4 images sur les 4 premières lignes.
Pas de problème pour les 3 premières images. Par contre quand vous faites défiler les lignes via les scrollbars, on constate que la 4ieme ligne a bien l'image voulue mais toutes les lignes qui restent (soit 6) ont aussi cette image.
Evidemment la méthode refresh ne change rien.
Si quelqu'un à l'explication et une solution je suis prenneur .
Bon j'en profite pour vous dire à bientôt je pars en vacances demain soir . Portez vous bien .
Cirec
Messages postés3833Date d'inscriptionvendredi 23 juillet 2004StatutModérateurDernière intervention18 septembre 202250 27 juil. 2007 à 11:39
Salut,
après un rapide teste ... je n'arrive pas à obtenir le même résultat que toi
Chez moi tout fonctionne parfaitement !!!!
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin If (aRow in [1..4]) and (aCol > 0) Then With TStringGrid(Sender).Canvas doBegin Draw(Rect.Left, Rect.Top, Application.Icon);
End;
end;
procedure TSound_Form.Bands_StringGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
If InDrawing=False then Exit;
If (ARow in [1..IndexBand+1]) and (aCol =2) Then
With TStringGrid(Sender).Canvas do
Begin
Rect.Left:=Rect.Left+5;
Rect.Top:=Rect.Top+5;
Rect.Right:=Rect.Right-5;
Rect.Bottom:=Rect.Bottom-5;
StretchDraw(Rect, ImageBands[ARow-1].Picture.Graphic);
Bands_StringGrid.Refresh;
End;
end;