Stark
2012-03-17 17:08:21 UTC
If somebody is still visiting here, I would like to raise a question. I have
found on the net a beautiful example on how to make a professional looking
StringGrid. I have taken this example and I am trying to adapt it to my
needs. First of all, I need to fill the grid with data from a table.
In a normal situation I would have done something like (to simplify, suppose
1 column only):
while not Table1.Eof do
begin
GridOwnerDraw.Cells[row,col]:= GetText(Row,0);
inc(row);
Table1.next;
end;
In this case, the example is using a text string built inside the StringGrid
OnDraw Cell event. and the row is draw in the On Draw event with:
DrawText(gridOwnerDraw.canvas.Handle, PChar(str), length(str), txtRect,
DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
where str contains to text to be written in that cell.
I can't find a way to give the current field value to the DrawText . Any
suggestion ?
found on the net a beautiful example on how to make a professional looking
StringGrid. I have taken this example and I am trying to adapt it to my
needs. First of all, I need to fill the grid with data from a table.
In a normal situation I would have done something like (to simplify, suppose
1 column only):
while not Table1.Eof do
begin
GridOwnerDraw.Cells[row,col]:= GetText(Row,0);
inc(row);
Table1.next;
end;
In this case, the example is using a text string built inside the StringGrid
OnDraw Cell event. and the row is draw in the On Draw event with:
DrawText(gridOwnerDraw.canvas.Handle, PChar(str), length(str), txtRect,
DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
where str contains to text to be written in that cell.
I can't find a way to give the current field value to the DrawText . Any
suggestion ?