'################################### ' ' ' How to get line spacing example ' ' By Andy. ' ' ' '################################### $include "windowssdk.inc" $include "RichEdit.inc" 'Variables. WINDOW wx int AcrossX,DownY,Offset,StoreFL 'Your font preference. int FontSize = 24 string FontName = "Courier New" 'A string that will make two lines in a rich edit control. string This$ = "Opening files" + chr$(32) + chr$(10) + "Please wait..." + chr$(32) + chr$(10) + chr$(0) ' Task 1 - Create a window with a rich edit control in it. ' Taks 2 - Set the rich edit control with the two lines of text (String "This$"). OPENWINDOW wx,0,0,400,290,@MINBOX|@MAXBOX|@SIZE|@CAPTION,0,"Line spacing example",&handlerX CONTROL wx,@RICHEDIT,This$,7,35,370,120,0x50B010C4,1 '<--- Set the text here. SETFONT wx,FontName,FontSize,500,0,1 '<--- Set the rich edit to your font preference. SETCONTROLCOLOR wx,1,RGB(0,0,0),RGB(255,255,255) int rHandle = getcontrolhandle(wx,1) ' Task 3 - Get the first down position of line 0 (zero - the first line). SENDMESSAGE(rHandle,EM_SETSEL,0,0) '<--- Set the selection to first character of first line. setfocus wx,1 '<--- Set the focus to the rich edit so we can get carot position. GETCARETPOSITION wx,AcrossX,DownY '<--- Get carot position (cursor position on screen). StoreFL = DownY '<--- Store this position. ' Taks 4 - Do the same (as above) but for line 1 (the second line). Offset = SendMessage(rHandle,EM_LINEINDEX,1,0) '<--- This time we need line 1's offset (first char pos). SENDMESSAGE(rHandle,EM_SETSEL,Offset,Offset) '<--- Set the selection to first character of second line. setfocus wx,1 '<--- Set the focus to the rich edit so we can get carot position. GETCARETPOSITION wx,AcrossX,DownY '<--- Get new carot position (cursor position on screen). SETFONT wx,"Microsoft Sans Serif",12,500,0 move wx,10,190 ' Taks 5 - Calculate the difference. print wx,"Line spacing is ",DownY - StoreFL '<-------------- The answer is the difference between them. waituntil iswindowclosed(wx) end SUB handlerX(),INT SELECT @MESSAGE CASE @IDCREATE CENTERWINDOW wx CASE @IDCLOSEWINDOW CLOSEWINDOW wx CASE @IDCONTROL SELECT @CONTROLID CASE 1 IF @NOTIFYCODE = 0 ENDIF ENDSELECT ENDSELECT RETURN 0 ENDSUB