ImageGear for C and C++ on Windows v21.0 - Updated
API Reference Guide / ArtX Component API Reference / ArtX Component Objects Reference / HIG_ARTX_MARK / IG_ARTX_mark_user_data_set
In This Topic
    IG_ARTX_mark_user_data_set
    In This Topic

    This function sets the user data associated with mark.

    Declaration:

     
    Copy Code
    AT_ERRCOUNT IG_ARTX_mark_user_data_set(
            HIG_ARTX_MARK hMark,
            LPAT_VOID lpData
    );
    

    Arguments:

    Name Type Description
    hMark HIG_ARTX_MARK Annotation handle.
    lpData LPAT_VOID User data pointer.

    Return Value:

    Error count.

    Supported Raster Image Formats:

    This function does not process image pixels.

    Sample:

    None

    Example:

     
    Copy Code

    HIG_ARTX_PAGE    hArtPage = NULL;                //ArtX page handle
    HIG_ARTX_MARK    hNewMark, hNewMarkRet = NULL;    //Annotation handles
    AT_RECTANGLE    rcRectangle = {10, 10, 100, 60};//annotation boundary
    AT_RGBQUAD        rgb = {0xff, 0, 0xff, 0};        //annotation color

    AT_CHAR szUserDataText[] = "Annotation sample Userdata"; //user data to be associated with annotation

    //Create new ArtX page
    IG_ARTX_page_create(&hArtPage);

    //Create new Ellipse annotation
    IG_ARTX_filled_ellipse_create(&rcRectangle, &rgb, FALSE, &hNewMark);

    //Add new annotation into ArtX page
    IG_ARTX_page_mark_add(hArtPage, hNewMark, IG_ARTX_COORD_IMAGE, &hNewMarkRet);

    //Set annotation's user data attribute
    IG_ARTX_mark_user_data_set(hNewMarkRet, szUserDataText);

    //save annotation data to file
    IG_ARTX_page_save_file(hArtPage, "ArtXSampleData.xml", 1, TRUE, IG_ARTX_SAVE_XML);

    Remarks:

    This function stores a copy of a zero-terminated character string, passed via lpData parameter, in annotation’s internal data structure.

    Use IG_ARTX_mark_user_data_get() to retrieve the user data.

    These functions only work with zero-terminated character strings and not with arbitrary pointers. When ArtX marks are saved to a file, user data is saved as well.