<< Click to display table of contents >> TSRichViewEdit.GetItemBounds, GetItemBounds100 |
The methods return the coordinates and size of the specified item or its part.
function GetItemBounds(RVData: TCustomRVData; ItemNo: Integer;
Part: Integer = -1; AllowFloating: Boolean = True) : TRect;
RVData is a document (RichViewEdit.RVData, table cell, or cell inplace editor's RVData), ItemNo is an index of item in this document.
If Part=-1, the result is returned for the whole item. Otherwise, it is returned for the specified item part, counted from 0. A text item may have more than one part if drawn on several lines. To enumerate all parts, start calling this method from Part=0 and increase this value until the method returns Rect(-1, -1, -1, -1). You can use the function RichViewEdit.RVData.GetItemPart to get the item part for the position in the document.
The returned coordinates are relative to the top left corner of the item's (or part's) page (see GetItemPages). If the item spans across several pages (it is possible only if Part=-1), the top left corner is relative to the first item page, the bottom left corner is relative to the last item page.
Coordinates are scaled (see ViewProperty.ZoomPercent).
To get the client coordinates of the item, add top and left coordinates returned by GetPageClientRect.
AllowFloating defines which coordinates are returned for left- and right-aligned items (for all other items, this parameter is ignored). If True, the method returns coordinates of the object (such as an image or an control). If False, the method returns coordinates of a placeholder, i.e. coordinates of the point of insertion of this object in a line.
function GetItemBounds100(RVData: TCustomRVFormattedData;
ItemNo: Integer; var ARect: TRect; var PageNoB, PageNoE: Integer;
Part: Integer = -1; AllowFloating: Boolean = True) : Boolean;
This method is similar, but:
•the resulting coordinates are returned in ARect parameter; they are is valid only if this method returns True;
•the coordinates are not scaled (they correspond to zooming = 100%)
•this method returns False if an incorrect part index is specified; all output parameters are valid only if this method returns True;
•this method returns the fist and the last item (or part) pages in PageNoB and PageNoE parameters, so it is not necessary to call GetItemPages;
See also: