Custom DBGrid Component
Posted on 2002-05-28
i want to create a component inherited from DBGrid. what i want to do in this component is to have a picture displayed on a certain column aside from the fields column queried from the database.
below is the code i tried using on my application and is working. since i will be using this throughout my application i wish to convert it to a component. i have tried converting but i was stucked on the image to be added. i want to have an additional property (Picture) where i can define the location of the picture i want and use this on all the rows displayed.
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
bmp : TBitmap;
if Column.FieldName = '' then
with Canvas do
Brush.Bitmap := Image1.Picture.Bitmap;