Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSHFlexGrid Cell Resize under Win 2000
Message
De
07/06/2001 02:02:06
Jon Nelson
Trader Systems Limited
Reading, Royaume Uni
 
 
À
04/06/2001 16:38:46
Jon Nelson
Trader Systems Limited
Reading, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00514827
Message ID:
00516171
Vues:
22
>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


I have tried to replace the SENDMESSAGE way of determining the number of lines of text by using the RichTx32 GetLineFromChar method. Again this works perfectly under Win NT4.0 but returns the wrong result under Win2000. I'm using VFP6 SP4 but see from MSDN that under VFP5.0 this was a problem. (PRB: GetLineFromChar Method Does Not Function in VFP 5.0 ID: Q198425)

Any ideas???
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform