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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ok, so i have a stringgrid on my fo

Status
Not open for further replies.

Rached

Programmer
Mar 30, 2003
54
DK
ok, so i have a stringgrid on my form. i set the text of the first fixed row as the following:

StringGrid1->Rows[0]->CommaText = "text1, text2, text3, text4, text5";

and i fill the rest of the rows the same way, with variable strings, A, B, C, D, E, F; but i have long strings of text some time, and i can not see all of it in the cell.i need to know how to resize, dynamically one or more cell to fit that text.
that's what i did at first:

StringGrid1->Rows[1]->CommaText""+string1+", "+string2+", "+string3+", "+string4", "+string5+"";

and then i found out that my last string5 that contains spaces is split in the cell where the space is so i did this:

StringGrid1->Rows[1]->CommaText""+string1+", "+string2+", "+string3+", "+string4"";
StringGrid1->Cells[4][1] = string5;


and it worked fine; but the problem is that not all the string is shown! i have long string5 some times, maybe 40 or more characters; so how can i resize the cell to fit the whole text?

tnx guys
 
I dont think you can size just a cell, the whole column must be sized.

from the help files-------------->

TCustomGrid::ColWidths

Indicates the width (in pixels) of all the columns in the grid.

__property int ColWidths[int Index] = {read=GetColWidths, write=SetColWidths};

Description

Read ColWidths to determine the width of the cells in the column specified by the Index parameter. An index of 0 refers to the first column. Set ColWidths at runtime to change the width of an individual column.

If the width of a column has not been set explicitly by resizing with the mouse, or by using the ColWidths property, its width is DefaultColWidth.

Use the ColCount property to determine the number of entries in the ColWidths array.

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top