Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > OOP
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Coloboración Paypal con ClubDelphi

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20/12/2004
neon neon is offline
Miembro
 
Join Date: Jul 2004
Posts: 62
Poder: 23
neon Va por buen camino
Dibujar imagen con ImageList en StringGrid

Hola,

quiero poder dibujar un icono almacenado en un imagelist en un StringGrid en tiempo de ejecución. El StringGrid tiene asociado un pop-up, y al seleccionar un item de este pop-up me debe dibujar el icono en una determinada columna.
El problema esta en que al no realizar esto en el evento on draw tengo una serie de problemas para calcular la posicion deseada y para que lo pinte inmediatamente.
Lo hago de la siguiente forma :

ImageList5.Draw(StringGrid1.Canvas, x, y, 1)
Reply With Quote
  #2  
Old 20/12/2004
Neftali [Germán.Estévez]'s Avatar
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Join Date: Jul 2004
Location: Barcelona - España
Posts: 19,449
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Debes utilizar el evento DrawCell para pintar la celda, ya que es el adecuado para ello; En todo caso en el PopupMenu lo que debes hacer es activar/desactivar un flag que te marque si se pinta el bitmap o no.

En el DrawCell coloca un código como éste:
Código Delphi [-]
var
  bmp:TBitmap;
begin
  //Flag para saber si pinto la imagen (iniciualmente FALSE)
  if (not MustPintar) then begin
    Exit;
  end;
  // Coumna que quiero pintar
  if (ACol <> 1) then begin
    Exit;
  end;
 
  // Crear
  bmp := TBitmap.Create();
  // proteccon
  Try
    // Asignar la imagen
    ImageList1.GetBitmap(0,bmp);
    // pintarla
    StringGrid1.Canvas.Draw(Rect.Left + 2, Rect.Top + 2, bmp);
  finally
    bmp.Free;
  end;

Luego en tu popupmenu añades un código como éste:

Código Delphi [-]
  MustPintar := not MustPintar;
  StringGrid1.Repaint;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 10:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi