Is it possible to fill a column in a data aware FNCDataGrid with the image who's name is he field value
Yes, it's possible, but you'll need to have a way to feed the image to the grid. For example, you could use a TTMSFNCBitmapContainer, fill it with the images (names will automatically be used). Then if the field is a string field containing the image name, you can use just:
procedure TForm43.TMSFNCDataGrid1BeforeDrawCell(Sender: TObject;
AGraphics: TTMSFNCGraphics; ACell: TTMSFNCDataGridCell;
var ACanDraw: Boolean);
begin
if (ACell.Column = 5) and (ACell.Row >= TMSFNCDataGrid1.FixedRowCount) then
ACell.DrawElements := ACell.DrawElements - [gcdText];
end;
procedure TForm43.TMSFNCDataGrid1GetCellClass(Sender: TObject; AColumn,
ARow: Integer; var ACellClass: TTMSFNCDataGridCellClass);
begin
if (AColumn = 5) and (ARow >= TMSFNCDataGrid1.FixedRowCount) then
ACellClass := TTMSFNCDataGridBitmapCell;
end;
procedure TForm43.TMSFNCDataGrid1GetCellProperties(Sender: TObject;
ACell: TTMSFNCDataGridCell);
begin
if (ACell.Column = 5) and (ACell.Row >= TMSFNCDataGrid1.FixedRowCount) then
begin
(ACell as TTMSFNCDataGridBitmapCell).BitmapName := TMSFNCDataGrid1.Strings[ACell.Column, ACell.Row];
(ACell as TTMSFNCDataGridBitmapCell).BitmapAlign := gcaClient;
end;
end;
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.