Andries Bos wrote: > I have a width of a cell and have to determain what part of a string > will fitt into this area. > > Currently I have this calucated by : > > while TextWidth(AText) < width do > Copy(AText, 1, Length(AText) - 1); > > Is there a faster way of doing this as I have to do this a lot of > times during a screen refresh (e.g. during scrolling or cell-width > change) > > Another way should be to "clip" the text into a rect, but i did not > find any examples on how to do this.
The DrawText API function can help you in both cases. You tell it the rectangle to use for clipping the text. You can also use the dt_ModifyString flag to tell it to update the buffer you pass in to reflect the actual string it was able to draw. -- Rob ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

