ExtensionMethods
Provides geometry, layout, color, and image helpers used by RichTextEditor.
Definition
Namespace:Telerik.WinForms.Documents.Layout
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public static class ExtensionMethods
Inheritance: objectExtensionMethods
Methods
Compares the rectangles' locations and dimensions using floating-point tolerance.
public static bool AreClose(this RectangleF rect1, RectangleF rect2)
The first rectangle to compare.
rect2RectangleFThe second rectangle to compare.
Returns:Walks up the layout-box parent chain to find the containing section.
Resolves a hierarchical document index through the document layout and returns its associated element.
public static T GetElement<T>(this HierarchicalIndex index, RadDocument document) where T : DocumentElement
The hierarchical index to resolve.
documentRadDocumentThe document whose layout is searched.
Returns:T
The indexed element when it has type T; otherwise, null.
Removes and returns the next queue item when one is available.
public static T ProbeDequeue<T>(this Queue<T> queue)
The queue to inspect.
Returns:T
The removed item, or the default value of T when the queue is empty.
Returns the top stack item without throwing when the stack is empty.
public static T ProbePeek<T>(this Stack<T> stack)
The stack to inspect.
Returns:T
The top item, or the default value of T when the stack is empty.
Removes and returns the top stack item when one is available.
public static T ProbePop<T>(this Stack<T> stack)
The stack to inspect.
Returns:T
The removed item, or the default value of T when the stack is empty.
Associates a layout box with a UI element so layout-aware UI providers can retrieve it later.
Copies the remaining stream content into a memory stream and assigns it as the bitmap source.
public static void SetSource(this BitmapImage bitmapImage, Stream imageStream)
The bitmap whose source is assigned.
imageStreamStreamThe stream containing the image data.
Loads image bytes into the bitmap and returns the bytes from the stream used for loading.
public static byte[] SetSourceEx(this BitmapImage bitmapImage, byte[] imageBytes, ref string extension)
The bitmap whose source is assigned.
imageBytesbyte[]The encoded image data.
extensionstringThe source file extension; it is lowercased and changed to png when conversion succeeds.
byte[]
The data from the stream used to load the bitmap, including PNG data when conversion occurs.
Loads an image stream, converting formats unsupported by the current platform to PNG when the matching decoder returns bitmap data.
public static Stream SetSourceEx(this BitmapImage bitmapImage, Stream imageStream, ref string extension)
The bitmap whose source is assigned.
imageStreamStreamThe encoded image data stream.
extensionstringThe source file extension; it is lowercased and changed to png when conversion succeeds.
The stream used for loading; after successful conversion this is the encoded PNG stream.
Splits a string on the specified separator while preserving empty entries.
Creates a Padding from a thickness by rounding each side to the nearest integer.