Язык программирования FreeBasic |
GetLenString
window9.GetLenString( STRING , X ,Y )
Используется для получения длины строки в пикселах. Функция находится в пространстве имен window9.
STRING - строка
X , Y - буферы типа Integer для получения ширины и высоты строки
Пример:
#Include "window9.bi"
Using window9
Dim Po As SinglePoint
Dim As String destST,tempST,SourceST="FreeBASIC is a self-hosting compiler which makes use of the GNU binutils programming tools as backends and can produce console, graphical/GUI executables, dynamic and static libraries."
Dim As Integer X,X1,Y,Y1
StartPrinter(@po)
FontDraw(LoadFont("Arial",22*po.x))
PageStart()
GetRealSize(x1,y1)
For a As Integer=0 To Len(SourceST)-1
GetLenString(TempST+Chr(SourceST[a]),x,y)
If x>=x1 Then
DestST=DestST+TempST+!"\n\r"
TempST=""
a-=1
Else
TempST+=Chr(SourceST[a])
EndIf
Next
DestST+=TempST
PrintText(DestST)
PageEnd()
StopPrinter()
Created with the Personal Edition of HelpNDoc: Easy to use tool to create HTML Help files and Help web sites