GetPreviewImage Method


Get the preview image of an element. This image is similar to what is seen in the Revit UI when selecting the type of an element.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2011

Syntax

C#
public virtual Bitmap GetPreviewImage(
	Size size
)
Visual Basic
Public Overridable Function GetPreviewImage ( _
	size As Size _
) As Bitmap
Visual C++
public:
virtual Bitmap^ GetPreviewImage(
	Size size
)

Parameters

size
Type: System.Drawing Size
The width and height of the preview image in pixels.

Return Value

System::Drawing::Bitmap represents the preview image. a null reference ( Nothing in Visual Basic) if there is no preview image.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The width or height of the size is equal or less than zero.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →