Display problem if bitmap used in a menu |
Post Reply |
Author | |
MikeM
Newbie Joined: 23 January 2009 Location: Belgium Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: 23 September 2010 at 8:30am |
Hi everybody,
I have a little display problem when I use a bitmap in my context menu. This problem is only visible when I use skinned mode. With skin : Without skin : In skinned mode, the bitmap is shifted to the left where this is not the case in normal mode. Any idea ? Here's a part of the sample source code : BOOL InsertMenuItemEx(CMenu *pMenu, UINT nPos, CBitmap *pBitmap, LPCTSTR lpszText, UINT nID, ULONG_PTR nItemData) { if (nPos == -1) nPos = pMenu->GetMenuItemCount(); HBITMAP hBitmap = (HBITMAP)pBitmap->GetSafeHandle(); MENUITEMINFO stMII; memset(&stMII, 0, sizeof(stMII)); stMII.cbSize = sizeof(stMII); stMII.fMask = MIIM_BITMAP; stMII.hbmpItem = hBitmap; if (lpszText && lpszText[0]) { stMII.fMask |= MIIM_STRING; stMII.dwTypeData = (LPSTR)lpszText; } if (nID) { stMII.fMask |= MIIM_ID; stMII.wID = nID; } if (nItemData) { stMII.fMask |= MIIM_DATA; stMII.dwItemData = nItemData; } return pMenu->InsertMenuItem(nPos, &stMII, TRUE); } CTEST_3255Dlg::CTEST_3255Dlg(CWnd* pParent) : CDialog(CTEST_3255Dlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_bContextMenuOpened = FALSE; m_cAudioEffectBitmap[0].LoadBitmap(IDB_BITMAP1); m_cAudioEffectBitmap[1].LoadBitmap(IDB_BITMAP2); m_cAudioEffectBitmap[2].LoadBitmap(IDB_BITMAP3); m_cAudioEffectBitmap[3].LoadBitmap(IDB_BITMAP4); } BEGIN_MESSAGE_MAP(CTEST_3255Dlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_CONTEXTMENU() END_MESSAGE_MAP() BOOL CTEST_3255Dlg::OnInitDialog() { CDialog::OnInitDialog(); SetIcon(m_hIcon, TRUE); SetIcon(m_hIcon, FALSE); return TRUE; } void CTEST_3255Dlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } HCURSOR CTEST_3255Dlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void CTEST_3255Dlg::OnContextMenu(CWnd *pWnd, CPoint point) { CPoint ptClient = point; ScreenToClient(&ptClient); CMenu cTopMenu; BOOL bRet = cTopMenu.LoadMenu(IDR_CONTEXT_MENU); if (!bRet) return; CMenu *pContextMenu = cTopMenu.GetSubMenu(0); if (!pContextMenu) return; ConstructContextMenu(pContextMenu, ptClient); if (m_bContextMenuOpened) { SendMessage(WM_CANCELMODE); CRect rect; GetWindowRect(&rect); if ( rect.PtInRect(ptClient) ) PostMessage(WM_CONTEXTMENU, (WPARAM)pWnd->GetSafeHwnd(), MAKELPARAM(ptClient.x,ptClient.y)); return; } m_bContextMenuOpened = TRUE; pContextMenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this); m_bContextMenuOpened = FALSE; } #define AUDIO_TRANSITION_FX 1 void CTEST_3255Dlg::ConstructContextMenu(CMenu *pContextMenu, CPoint pt) { UINT nDynamicID = 20000; CMenu *pSubMenu = pContextMenu->GetSubMenu(0); if (!pSubMenu) return; UINT nIndex = 0; InsertMenuItemEx(pSubMenu, nIndex++, &m_cAudioEffectBitmap[0], " ", nDynamicID++, MAKELONG(AUDIO_TRANSITION_FX,0)); InsertMenuItemEx(pSubMenu, nIndex++, &m_cAudioEffectBitmap[1], " ", nDynamicID++, MAKELONG(AUDIO_TRANSITION_FX,1)); InsertMenuItemEx(pSubMenu, nIndex++, &m_cAudioEffectBitmap[2], " ", nDynamicID++, MAKELONG(AUDIO_TRANSITION_FX,2)); InsertMenuItemEx(pSubMenu, nIndex++, &m_cAudioEffectBitmap[3], " ", nDynamicID++, MAKELONG(AUDIO_TRANSITION_FX,3)); } |
|
archies
Groupie Joined: 17 November 2009 Location: India Status: Offline Points: 33 |
Post Options
Thanks(0)
|
Hi;
me also facing same problem . I need to insert a Bitmap in the menuItem. But i have skinned framework:- XTPSkinManager()->SetApplyOptions(xtpSkinApplyMetrics|xtpSkinApplyFrame|xtpSkinApplyColors|xtpSkinApplyMenus); * if we use "xtpSkinApplyMenus" Bitpmap coming wrong ,, but without "xtpSkinApplyMenus" bitmap coming right (from AppendMenu method) thnx |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks, we will review it
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
archies
Groupie Joined: 17 November 2009 Location: India Status: Offline Points: 33 |
Post Options
Thanks(0)
|
Hi Oleg ; have you reviewed this issue ? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Not yet :(
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Code is updated for next release. If you want to test it before next release, create new issue in our issuetrack, I will attach changed files Thanks
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Asim
Newbie Joined: 27 March 2009 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
i created the issue in the issuetracker , but unfortunatley my assistance subscription faild on Oct-2010.
That's why issue not get submitted . What to do know. How can i get this resolved issue file. For this i have to active the subscription or anything else. pl revert. thnx Hi Oleg;
Please go through the link : http://forum.codejock.com/forum_posts.asp?TID=17306&PID=63819#63819 Now give me modified files , in which u fix this problem. Notes: ------------------------------------------- ****Note by Customer Service, 14 Apr 2011: I am sorry for this trouble. The maintenance for your order #76686 (ComponentSource 280264) for the Xtreme ToolkitPro bundle expired 13-OCT-10. Technical help and version upgrades are available with active maintenance subscriptions only. I am unable to assign your issue for assistance without an active maintenance contract. Please contact sales@codejock.com for assistance purchasing. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Yes, you need to be current to get the latest versions and fixes.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |