Hi,
I have a form that uses the MSHFlexGrid control. The grid has a number of columns some of which are re-sized to accommodate all the text. The cells are re-sized using SENDMESSAGE and a RichText control. See MSDN HOWTO: Adjust RowHeight of MSFlexGrid to Accommodate WordWrap ID: Q178127.
The form works fine under Windows NT 4.0 but the cell resizing gives the wrong results under Windows 2000.
The problem appears to be the number of lines of text returned by SendMessage is incorrect.
Has anybody had the same problem - and found any solutions???
Many thanks
Jon Nelson
The fragment of the code that resizes the cell is show:
----------------------------------------------------------
* MSHFlexGrid name gOrders
* RichTX32 control name rtbText
LPARAMETER lRow,lCol
* Select the Cell
thisform.gOrders.row=lRow
thisform.gOrders.col=lCol
lnColTwips=thisform.gOrders.cellwidth
* set the width of the textbox to the width of the column (pixels)
thisform.rtbText.width=lnColTwips/thisform.twipsperpixelX
* set the Rich text control text to the grid cell text
thisform.rtbText.text=ALLTRIM(thisform.gOrders.text)
* Get the height of a line of text (Pixels)
HeightOfLine=thisform.textheight(left(ALLTRIM(thisform.rtbText.text),1))
* Get the number of lines of text in the Rich text control
#DEFINE EM_GETLINECOUNT 186
LinesOfText=SendMessage(thisform.rtbText.hWnd,EM_GETLINECOUNT,0,0)
nHeightOfLineTwips=int(HeightOfLine * thisform.twipsperpixelY)
* Calculate the required height of the Row
lnReqHeight= LinesOfText*nHeightOfLineTwips
IF thisform.gOrders.RowHeight(lRow) < lnReqHeight
thisform.gOrders.RowHeight(lRow) = lnReqHeight
ENDIF