Skip to content

Commit 30f8bed

Browse files
author
ArthurHub
committed
* Add GetElementRectangle to HtmlPanel and HtmlLabel
1 parent 4699de7 commit 30f8bed

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎Source/HtmlRenderer/HtmlLabel.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,18 @@ public string GetHtml()
310310
return _htmlContainer != null ? _htmlContainer.GetHtml() : null;
311311
}
312312

313+
/// <summary>
314+
/// Get the rectangle of html element as calculated by html layout.<br/>
315+
/// Element if found by id (id attribute on the html element).<br/>
316+
/// Note: to get the screen rectangle you need to adjust by the hosting control.<br/>
317+
/// </summary>
318+
/// <param name="elementId">the id of the element to get its rectangle</param>
319+
/// <returns>the rectangle of the element or null if not found</returns>
320+
public RectangleF? GetElementRectangle(string elementId)
321+
{
322+
return _htmlContainer != null ? _htmlContainer.GetElementRectangle(elementId) : null;
323+
}
324+
313325

314326
#region Private methods
315327

‎Source/HtmlRenderer/HtmlPanel.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,18 @@ public string GetHtml()
257257
return _htmlContainer != null ? _htmlContainer.GetHtml() : null;
258258
}
259259

260+
/// <summary>
261+
/// Get the rectangle of html element as calculated by html layout.<br/>
262+
/// Element if found by id (id attribute on the html element).<br/>
263+
/// Note: to get the screen rectangle you need to adjust by the hosting control.<br/>
264+
/// </summary>
265+
/// <param name="elementId">the id of the element to get its rectangle</param>
266+
/// <returns>the rectangle of the element or null if not found</returns>
267+
public RectangleF? GetElementRectangle(string elementId)
268+
{
269+
return _htmlContainer != null ? _htmlContainer.GetElementRectangle(elementId) : null;
270+
}
271+
260272
/// <summary>
261273
/// Adjust the scrollbar of the panel on html element by the given id.<br/>
262274
/// The top of the html element rectangle will be at the top of the panel, if there

0 commit comments

Comments
 (0)