This document is archived and information here might be outdated.  Recommended version.


ISymbologyStyleClass.PreviewItem Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IS > ISymbologyStyleClass Interface > ISymbologyStyleClass.PreviewItem Method
ArcGIS Developer Help

ISymbologyStyleClass.PreviewItem Method

Previews the specified item as a bitmap.

[Visual Basic .NET]
Public Function PreviewItem ( _
    ByVal item As IStyleGalleryItem, _
    ByVal Width As Integer, _
    ByVal Height As Integer _
) As stdole.IPictureDisp
[C#]
public stdole.IPictureDisp PreviewItem (
    IStyleGalleryItem item,
    int Width,
    int Height
);
[C++]
HRESULT PreviewItem(
  IStyleGalleryItem* item,
  long Width,
  long Height
);
[C++]
Parameters
item [in]

item is a parameter of type IStyleGalleryItem* Width [in]
Width is a parameter of type long Height [in]
Height is a parameter of type long

Product Availability

Available with ArcGIS Engine.

Description

Returns a picture implementing IPictureDisp of the specified item. Use the method to display a preview of the item in another control, such as a PictureBox.

Errors Returned

1078 800a0436: The specified item is not recognized as a valid symbology

[C#]

//Get the style class 
ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass);

//Preview an image of the symbol
stdole.IPictureDisp picture = symbologyStyleClass.PreviewItem(m_styleGalleryItem, pictureBox1.Width, pictureBox1.Height);
System.Drawing.Image image = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle));
pictureBox1.Image = image;

[Visual Basic .NET]

'Get the style class
Dim symbologyStyleClass As ISymbologyStyleClass
symbologyStyleClass = AxSymbologyControl1.GetStyleClass(AxSymbologyControl1.StyleClass)

'Preview an image of the symbol
Dim picture As stdole.IPictureDisp
picture = SymbologyStyleClass.PreviewItem(m_styleGalleryItem, PictureBox1.Width, PictureBox1.Height)
Dim image As System.Drawing.Image
image = System.Drawing.Image.FromHbitmap(New System.IntPtr(picture.Handle))
PictureBox1.Image = image

See Also

ISymbologyStyleClass Interface