[]
        
(Showing Draft Content)

C1.WPF.Word.C1WordDocument.DrawElement

DrawElement Method

DrawElement(FrameworkElement, Rect, ContentAlignment, Stretch)

Draws the specified WriteableBitmap object at the specified location, adjusting the image size as specified by the align and stretch parameters.

Declaration
public void DrawElement(FrameworkElement e, Rect rc, ContentAlignment align, Stretch stretch)
Parameters
Type Name Description
FrameworkElement e

FrameworkElement to render into the document.

Rect rc

The rectangle structure that specifies the location of the drawn element, in points from the top left corner of the page.

ContentAlignment align

ContentAlignment value that specifies how the element should be aligned within the rectangle.

Stretch stretch

Stretch value that specifies how the element should be sized to fit the rectangle.

Remarks
<p>This method must be called from the main thread. Calling it from a background thread will

raise a cross-thread exception when the method tries to access the properties of the FrameworkElement being rendered.

DrawElement(FrameworkElement, Rect, Rect)

Draws a FrameworkElement into the document at a specified position.

Declaration
public void DrawElement(FrameworkElement e, Rect rc, Rect rcClip)
Parameters
Type Name Description
FrameworkElement e

FrameworkElement to render into the document.

Rect rc

A rectangle where the element will be rendered.

Rect rcClip

A rectangle that defines the clipping bounds.

Remarks
<p>This method uses a <xref href="System.Windows.Media.VisualTreeHelper" data-throw-if-not-resolved="false"></xref> to render each of the 

primitives that compose the root element. It does not convert the element into a bitmap. As a result, the output is smaller and resolution independent; however, the result is not as faithful as a bitmap rendering. To render an element as a bitmaps, create a WriteableBitmap and pass it to the DrawImage(WriteableBitmap, Rect) method.

This method must be called from the main thread. Calling it from a background thread will raise a cross-thread exception when the method tries to access the properties of the FrameworkElement being rendered.

DrawElement(FrameworkElement, Rect)

Draws a FrameworkElement into the document at a specified position.

Declaration
public void DrawElement(FrameworkElement e, Rect rc)
Parameters
Type Name Description
FrameworkElement e

FrameworkElement to render into the document.

Rect rc

A rectangle where the element will be rendered.

Remarks
<p>This method uses a <xref href="System.Windows.Media.VisualTreeHelper" data-throw-if-not-resolved="false"></xref> to render each of the 

primitives that compose the root element. It does not convert the element into a bitmap. As a result, the output is smaller and resolution independent; however, the result is not as faithful as a bitmap rendering. To render an element as a bitmaps, create a WriteableBitmap and pass it to the DrawImage(WriteableBitmap, Rect) method.

This method must be called from the main thread. Calling it from a background thread will raise a cross-thread exception when the method tries to access the properties of the FrameworkElement being rendered.