[]
        
(Showing Draft Content)

C1.Xaml.Pdf.C1PdfDocument.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)
Public Sub DrawElement(e As FrameworkElement, rc As Rect, align As ContentAlignment, stretch As Stretch)
Parameters
Type Name Description
FrameworkElement e

FrameworkElement to render into the document.

Rect rc

System.Windows.Rect structure that specifies the location of the drawn element, in points from the top left corner of the page.

ContentAlignment align

C1.Util.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

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)
Public Sub DrawElement(e As FrameworkElement, rc As Rect, rcClip As Rect)
Parameters
Type Name Description
FrameworkElement e

FrameworkElement to render into the document.

Rect rc

System.Windows.Rect where the element will be rendered.

Rect rcClip

System.Windows.Rect that defines the clipping bounds.

Remarks

This method uses a VisualTreeHelper 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)
Public Sub DrawElement(e As FrameworkElement, rc As Rect)
Parameters
Type Name Description
FrameworkElement e

FrameworkElement to render into the document.

Rect rc

System.Windows.Rect where the element will be rendered.

Remarks

This method uses a VisualTreeHelper 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.