treeview e listbox invisivel

Delphi

16/06/2004

GOSTARIA DE SABER COMO DEIXO O FUNDO DE UM LISTBOX OU DE UM TREEVIEW INVISIVEL. SE NAO FOR POSSIVEL, ENTAO COMO APLICO UMA IMAGEM NELES???


Thaleshcv

Thaleshcv

Curtidas 0

Respostas

Tatuweb

Tatuweb

16/06/2004

Para adicionar uma imagem no fundo de um treeview utilize a rotina abaixo:

var
  Form1: TForm1;
  Bitmap: TBitmap;     <- Variavel Global

implementation

{$R *.DFM}

procedure TForm1.FormCreate (Sender: TObject);
begin
   Bitmap := TBitmap.Create;
   Bitmap.LoadFromFile (´C:\Arquivo.bmp´) ;
end;

procedure TForm1.FormPaint(Sender: TObject);
var
  X, Y, W, H: LongInt;
begin
  with Bitmap do
  begin
    W := Width;
    H := Height;
  end;
  Y := 0;
//  while Y < Height do
//  begin
    X := 0;
//    while X < Width do
//    begin
      TreeView1.Canvas.Draw(X, Y, Bitmap) ;
//      Inc(X, W) ;
//    end;
//    Inc(Y, H) ;
//  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  BitMap.Free;
end;

Se vc quiser colocar a figura lado-a-lado basta retirar os comentários.


GOSTEI 0
Anicetojunior

Anicetojunior

16/06/2004

eu estou com um probleminha,quando eu clico em um dos NOS do meu tree view ele apaga a figura no local selecionado,como eu faço para fazer que ele nao tire ?


GOSTEI 0
Tatuweb

Tatuweb

16/06/2004

Veja no tópico abaixo. Estou respondendo lá porque outra pessoa também perguntou.
:arrow: http://delphiforum.icft.com.br/forum/viewtopic.php?t=53506


GOSTEI 0
POSTAR