[]
        
(Showing Draft Content)

C1.Xaml.Pdf.C1WordDocument.DrawImage

DrawImage Method

DrawImage(WriteableBitmap, 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 DrawImage(WriteableBitmap img, Rect rc, ContentAlignment align, Stretch stretch)
Public Sub DrawImage(img As WriteableBitmap, rc As Rect, align As ContentAlignment, stretch As Stretch)
Parameters
Type Name Description
WriteableBitmap img

WriteableBitmap object to draw.

Rect rc

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

ContentAlignment align

C1.Util.ContentAlignment value that specifies how the image should be aligned within the rectangle.

Stretch stretch

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

Examples

The code below shows how you can use the DrawImage method can be used to render any UIElement. The code creates a WriteableBitmap from the element, then calls the DrawImage method:

void DrawImage(UIElement e, Rect rc, ContentAlignment align, ImageSizeMode mode)
{
  DrawImage(new WriteableBitmap(e, null), rc, align, mode);
}

DrawImage(WriteableBitmap, Rect)

Draws the specified WriteableBitmap object at the specified location, stretching it to fit the destination rectangle.

Declaration
public void DrawImage(WriteableBitmap img, Rect rc)
Public Sub DrawImage(img As WriteableBitmap, rc As Rect)
Parameters
Type Name Description
WriteableBitmap img

WriteableBitmap object to draw.

Rect rc

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

Examples

The code below shows how you can use the DrawImage method can be used to render any UIElement. The code creates a WriteableBitmap from the element, then calls the DrawImage method:

void DrawImage(UIElement e, Rect rc)
{
  DrawImage(new WriteableBitmap(e, null), rc);
}

DrawImage(WriteableBitmap, Rect, Rect)

Draws the specified WriteableBitmap object at the specified location, clipping the output to the given clipping rectangle.

Declaration
public void DrawImage(WriteableBitmap img, Rect rc, Rect rcClip)
Public Sub DrawImage(img As WriteableBitmap, rc As Rect, rcClip As Rect)
Parameters
Type Name Description
WriteableBitmap img

WriteableBitmap object to draw.

Rect rc

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

Rect rcClip

System.Windows.Rect structure that specifies a clipping rectangle on the page. No part of the image is drawn outside the clipping rectangle.

Examples

The code below shows how you can use the DrawImage method can be used to render any UIElement. The code creates a WriteableBitmap from the element, then calls the DrawImage method:

void DrawImage(UIElement e, Rect rc, Rect rcClip)
{
  DrawImage(new WriteableBitmap(e, null), rc, rcClip);
}

DrawImage(int, int, int[], Rect, Rect)

Draws the specified ARGB pixels at the specified location, clipping the output to the given clipping rectangle.

Declaration
public void DrawImage(int width, int height, int[] pixels, Rect rc, Rect rcClip)
Public Sub DrawImage(width As Integer, height As Integer, pixels As Integer(), rc As Rect, rcClip As Rect)
Parameters
Type Name Description
int width

The width of thne image in pixels.

int height

The height of thne image in pixels.

int[] pixels

The ARGB color array.

Rect rc

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

Rect rcClip

System.Windows.Rect structure that specifies a clipping rectangle on the page. No part of the image is drawn outside the clipping rectangle.