Пример #1
0
// enable menu for bitmap export with right click
void CTextureCtrl::OnRButtonUp(int cx, int cy)
{
	POINT pt;
	pt.x = cx;
	pt.y = cy;
	ClientToScreen(*this, &pt); 

	HMENU menu=CreatePopupMenu();
	AppendMenu(menu,MF_STRING,IDM_SAVE_AS, _T("&Save as..."));
	UINT msg=TrackPopupMenu(menu,TPM_RETURNCMD | TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_LEFTALIGN,pt.x,pt.y,0,*this,NULL);

	if(msg==IDM_SAVE_AS)
	{
		CFileDialog dlg;
		dlg.Create(*this,_T("Bitmap image (*.bmp)|*.BMP|All files (*.*)|*.*||"),_T("Save converted texture"),OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT,false);
		if(dlg.DoModal()==IDOK)
		{
			tex_cache.SaveBitmap(dlg.GetFileName());
		}
	}
}