English

How To: Export the Legend as a Bitmap in VC++

Summary

This document contains sample code to demonstrate how to export the MapObjects legend control as a bitmap.

Procedure

  1. Create a variable to store the index number of the layer to be exported.
    Use -1 to add all layers to the bitmap of the Legend.

    Code:
    short i = -1;

  2. Create a variable to store the path and location of the bitmap.

    Code:
    BSTR str = SysAllocString(L"C:\\temp\\temp.bmp");

  3. Export the Legend as a BMP file

    Code:
    m_legend.ExportToBmp(&str, &i);