Below is sample code on how to create a Legend using subwindows. Legend remain the same size when you re-size your main window.
void CSolidHoopsView::OnExtraSlot5() {
HC_Open_Segment_By_Key(m_pHView->GetViewKey()); {
HC_Open_Segment("legend"); {
// set a anchor point on top-left corner of the main window
// offsets=(left, right, down, up) represent the size of your subwindow in pixels.
// HC_Set_Window_With_Options(-1, -1, 1, 1, "offsets=(0, 150, -400, 0)");
// set a anchor point on top-right corner of the main window
// offsets=(left, right, down, up) represent the size of your subwindow in pixels.
HC_Set_Window_With_Options(1, 1, 1, 1, "offsets=(-150, 0, -400, 0)");
// set a anchor point on bottom-left corner of the main window
// offsets=(left, right, down, up) represent the size of your subwindow in pixels.
// HC_Set_Window_With_Options(-1, -1, -1, -1, "offsets=(0, 150, 0, 400)");
// set a anchor point on bottom-right corner of the main window
// offsets=(left, right, down, up) represent the size of your subwindow in pixels.
// HC_Set_Window_With_Options(1, 1, -1, -1, "offsets=(-150, 0, 0, 400)");
HC_Set_Window_Pattern("invisible");
HC_Set_Visibility("geometry=on,vertices=off");
HC_Read_Metafile("D:/SDHV/legend.hmf", ".", "");
HPoint position, target, up;
float field_width, field_height;
position.Set(0, 0, 1);
target.Set(0, 0, 0);
up.Set(0, 1, 0);
HC_Set_Camera(&position, &target, &up, 0.5f, 0.5f, "orthographic");
HC_Dolly_Camera(-0.2f, -0.7f, 0);
} HC_Close_Segment();
} HC_Close_Segment();
m_pHView->Update();
}
Video:
HMF file:
legend.zip (1.1 KB)