Subject | Re: [IBO] Re: bmp in tib_grid |
---|---|
Author | John Peterson |
Post date | 2002-06-04T01:06:13Z |
It can be done easily....the below snippet should get you started.....
Assign the onDrawCell Event.....
procedure TilvsClientForm.JobGridDrawCell(Sender: TObject; ACol, ARow:
Integer;
Rect: TRect; State: TGridDrawState);
begin
if jobGrid.DataSource.DataSet.Active then
if ACol = BOOLEANCOLUMN then begin
if JobGrid.BuffFields[Acol-1].AsBoolean = TRUE then
JobGrid.Canvas.Draw(Rect.Left,Rect.Top,BitMapTick)
else
JobGrid.Canvas.Draw(Rect.Left,Rect.Top,BitMapCross);
end else
with jobGrid do DefaultDrawCell( ACol, ARow,
Rect,
State,
GetCellDisplayText( ACol, ARow ),
GetCellAlignment( ACol, ARow ));
end;
You need to set the column width the match the bitmap width also.
Similar code can also place bitmaps in the Header Row, by hooking the
onDrawTitle event, and detecting the correct ACol.
hth
John
Assign the onDrawCell Event.....
procedure TilvsClientForm.JobGridDrawCell(Sender: TObject; ACol, ARow:
Integer;
Rect: TRect; State: TGridDrawState);
begin
if jobGrid.DataSource.DataSet.Active then
if ACol = BOOLEANCOLUMN then begin
if JobGrid.BuffFields[Acol-1].AsBoolean = TRUE then
JobGrid.Canvas.Draw(Rect.Left,Rect.Top,BitMapTick)
else
JobGrid.Canvas.Draw(Rect.Left,Rect.Top,BitMapCross);
end else
with jobGrid do DefaultDrawCell( ACol, ARow,
Rect,
State,
GetCellDisplayText( ACol, ARow ),
GetCellAlignment( ACol, ARow ));
end;
You need to set the column width the match the bitmap width also.
Similar code can also place bitmaps in the Header Row, by hooking the
onDrawTitle event, and detecting the correct ACol.
hth
John
----- Original Message -----
From: "stanw1950" <stanw@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, June 04, 2002 8:50 AM
Subject: [IBO] Re: bmp in tib_grid
> Since I am not getting an answer to this question, can I assume that
> it can't be done? There are no examples in the sample apps. Thanks.
>
> Stan Walker
>
>
> --- In IBObjects@y..., "stanw1950" <stanw@e...> wrote:
> > I want to draw a bmp in a tib_grid in the getcellprops procedure. I
> > finally got the row coloring and the cell coloring the way I want
> it,
> > but if one field is 'Y' then I want to show a bmp in the cell
> instead
> > of 'Y'. I have the bmp in a resource file, so it is readily
> > available. (D6; IBO4.2hc). Thanks in advance.
> >
> > Stan Walker
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>