1. Create a BCG project bcupladialmenusingle Based on the dialog box.
2. Create or find a PNG Image with Several icons on it. Import to project. After the import, the type is PNG resource ID is idr_png1.
3. Use the Class Wizard to override pretranslatemessage.
Bool cbcupladialmenusingledlg: pretranslatemessage (MSG * PMSG)
{
If (PMSG-> message = wm_rbuttondown)
{
Cpoint point = PMSG-> pt;
Cbcupladialmenu * pmenuctrl = new cbcupladialmenu;
Cbcupladialmenuobject * pmenu = pmenuctrl-> getradialmenuobject ();
Assert_valid (pmenu );
Pmenu-> setimagelist (idr_png1 );
Pmenu-> addcommand (id_edit_paste, 2/* image Index */);
Pmenu-> addcommand (id_edit_cut, 3/* image Index */);
Pmenu-> addcommand (id_edit_copy, 4/* image Index */);
Pmenu-> enablecenterbutton ();
Pmenu-> addcommand (id_edit_clear, 7/* image Index */);
Pmenuctrl-> createpopup (point, (byte) (155 ));
}
Return cbcgpdialog: pretranslatemessage (PMSG );
}
4. Run Ctrl + F5, right-click the dialog box, and select effect.
Note:
1. Because the cbcupladialmenu family has a child cstatic, drag a static control directly on the interface and associate it with the variable of the cbcupladialmenu type, so that the disk menu always appears.
Download source code:
BCG disc menu
BCG disc menu