Object Properties Page Icons

This brief guide discusses how to provide an icon for a custom object properties page using C/C++.

Problem

In Rhino, the object properties dialog shows a list of icons that allows you to select between the available properties pages. You would like to add a custom icon to the object properties dialog when your plugin adds a custom page.

Solution

Derive your custom object properties page from CRhinoObjectPropertiesDialogPageEx, which has a virtual Icon() member that you must override and implement. You will want to implement this virtual function as follows:

HICON CTestObjectPropertiesPageExDlg::Icon() const
{
  AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  return (HICON)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_OBJPROPPAGE_DIALOG), IMAGE_ICON, 24, 24, LR_SHARED);
}

NOTE: Make carefully the AFX_MANAGE_STATE macro. See MFC Technical Notes 33 and 58 for additional details.