Fórum Stringgrid Checklist #207605
19/01/2004
0
Alguem tem algum exemplo de como ter botoes checklist dentro de uma stringgrid ? Achei um exemplo em cima da Dbgrid, e mesmo assim dá certo na pesquisa, em modo de inserção da pau. Alguem pode me ajudar ?
Midas
Curtir tópico
+ 0
Responder
Posts
20/01/2004
Nigro
Acho que seria mais fácil colocar aqui o código do DBgrid para acertarmos.
Responder
Gostei + 0
20/01/2004
Midas
Consegui inserir os bimaps para emular o botão do check list, porem ao mover os bitmaps ele pinta, move para todas as celulas e não uma em especial. Tem como eu mover o bitmap apenas para uma em especial. O codigo esta aqui.
procedure Tf_usuario.StringGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
i:integer;
begin
if stringgrid.cells[3,0] = ´Excluir´ then // localizar apenas a coluna excluir
begin
stringgrid.Canvas.FillRect(rect);
imagelist1.Draw(stringgrid.Canvas,rect.left+10,rect.top+10,0);
if i_cont= 0 then // uso esta variavel para indicar se é true ou false para mover o bitmap correto.
begin
stringgrid.Canvas.FillRect(rect);
imagelist1.Draw(stringgrid.Canvas,rect.left+10,rect.top+10,1);
end
else
begin
stringgrid.Canvas.FillRect(rect);
imagelist1.Draw(stringgrid.Canvas,rect.left+10,rect.top+10,2);
end;
end;
end;
Acontece que ele não move só para a coluna Excluir e sim para todas. Como fazer para mover apenas para as celulas da coluna indicada ?
Obs. no evento de click atribuo valores ao i_cont = 0 ou 1 ;
procedure Tf_usuario.StringGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
i:integer;
begin
if stringgrid.cells[3,0] = ´Excluir´ then // localizar apenas a coluna excluir
begin
stringgrid.Canvas.FillRect(rect);
imagelist1.Draw(stringgrid.Canvas,rect.left+10,rect.top+10,0);
if i_cont= 0 then // uso esta variavel para indicar se é true ou false para mover o bitmap correto.
begin
stringgrid.Canvas.FillRect(rect);
imagelist1.Draw(stringgrid.Canvas,rect.left+10,rect.top+10,1);
end
else
begin
stringgrid.Canvas.FillRect(rect);
imagelist1.Draw(stringgrid.Canvas,rect.left+10,rect.top+10,2);
end;
end;
end;
Acontece que ele não move só para a coluna Excluir e sim para todas. Como fazer para mover apenas para as celulas da coluna indicada ?
Obs. no evento de click atribuo valores ao i_cont = 0 ou 1 ;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)