I have a StringGrid and can write text in its cells when the DefaultDraw property set to true.
To get more control I'm writing text in the cells with Windows DrawText() - but the cells stay empty.
The (simplified) code is
To get more control I'm writing text in the cells with Windows DrawText() - but the cells stay empty.
The (simplified) code is
Code:
String thing = "Hello" ;
int lenny = thing.Length() ;
LPRECT square = &(static_cast<RECT>(Form5->StringGrid1->CellRect(0,1))) ;
LPCTSTR stringy = static_cast<LPCTSTR>(thing.c_str()) ;
DrawText(Form5->StringGrid1->Canvas, stringy, lenny, square, DT_LEFT |DT_VCENTER |DT_SINGLELINE);
[/code}
DeFaultDraw = false ;
In debug everything looks ok except that DrawText() returns 0, not the font height.
Why doesn't the text appear ?