CMenu에 Image 추가하기

CMenu에 Bitmap 이미지를 추가하는 방법

CMenu는 각각
메뉴 생성시 이미지를 추가하는 방법과
BOOL InsertMenu( UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp );
메뉴의 이미지를 변경한 방법
BOOL SetMenuItemBitmaps( UINT nPosition, UINT nFlags, const CBitmap* pBmpUnchecked, const CBitmap* pBmpChecked );
을 제공하고 있다.
head에
CBitmap bmp; 을 선언하고
메뉴가 생성될 때 아래 예와 같이 처리해 주면 된다.

if(!bmp.GetSafeHandle())
       	bmp.LoadBitmap(IDB_STATUS_START);
	if(!m_MenuFunction.GetSafeHmenu())
	{
	    m_MenuFunction.CreatePopupMenu();
  	    m_MenuFunction.InsertMenu(MF_BYCOMMAND,MF_STRING,ID_MANUAL_SEQ,"Run Selected Item");
	    m_MenuFunction.InsertMenu(MF_BYCOMMAND,MF_STRING,WM_SET_ENABLE,"Set Enable Item");
	    m_MenuFunction.InsertMenu(MF_BYCOMMAND,MF_STRING,WM_SET_SKIP,"Set Disable Item");
	    m_MenuFunction.InsertMenu(MF_BYCOMMAND,MF_STRING,WM_SET_STOP,"Set Break Point");
	    m_MenuFunction.InsertMenu(MF_BYCOMMAND,MF_STRING,WM_SET_START,"Set Restart Point");
	    m_MenuFunction.SetMenuItemBitmaps(WM_SET_START,MF_BYCOMMAND,&bmp,&bmp);
	}
	m_MenuFunction.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,this,NULL);

“CMenu에 Image 추가하기”의 6개의 댓글

  1. Excellent pieces. Keep writing such kind of info
    on your site. Im really impressed by your blog.

    Hello there, You have done an incredible job.
    I’ll certainly digg it and individually recommend to my friends.
    I am sure they will be benefited from this website.

댓글 남기기