Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The joys of text with my StringGrid

Status
Not open for further replies.

johncp

Technical User
Aug 28, 2005
47
GB
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

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 ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top