Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to load .ico image file in ribbon node ? Collapse All
Subject Author Date
Mr Tran Jul 29, 2008 - 9:54 AM

Hi !

I know how to load bitmap file in ribbon node by using LoadBMP_Resource function:


For example:


 CExtRibbonNode * pNodeOpen =new CExtRibbonNode( ID_FILE_OPEN, 0, NULL, 0, _T("Open"));

    pNodeOpen->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’O’) ) ), false );

    pNodeOpen->RibbonILE_RuleRemoveSmallILV();

    VERIFY( pNodeOpen->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_OPEN_LARGE) ) );

    pNodeOpen->m_iconBig.m_bmpNormal.Make32();

    pNodeOpen->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );

    VERIFY( pNodeOpen->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_OPEN_SMALL) ) );

    pNodeOpen->m_iconSmall.m_bmpNormal.Make32();

    pNodeOpen->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );


but i want to load .ico file in ribbon node. I searched in forum but didn’t find result.  How to load .ico (icon) image file in ribbon node ??


Thanks alot.

Mr Tran Aug 31, 2008 - 8:16 PM

Tell me how speed between to load .ico file and .bmp file into ribbon node ? Thanks !

Technical Support Sep 1, 2008 - 7:44 AM

Loading a BMP file includes loading a BMP header data structure, allocating the memory buffer for pixels, and loading pixels from a file or a resource section into the memory buffer. That’s all. The memory buffer is an internal part of the CExtBitmap object. This works on any Windows OS version including Windows 95 and Windows NT4. Prof-UIS even supports 32-bit bitmaps with alpha channel on these old Windows versions.

Loading an ICO file consists of loading an icon into an HICON handle, creating a 32-bit HBITMAP handle, creating an image list based on this handle, inserting an icon into the image list, getting part of the bitmap into the allocated buffer inside CExtBitmap object.

We didn’t measure the time of each of these two algorithms. But using the CExtBitmap class without any HICON / HBITMAP handle is definitively much faster. The CExtCmdIcon class is also based on the CExtBitmap class.

Mr Tran Jul 30, 2008 - 10:46 AM

Thanks for your advice. I have done it. In addtion i have a question about windows title. I’m using Prof-UI v.2.82 for MFC and i created mainfrm using ribbonbar , and i want to enlarge mainfrm window title and bold text. How can i do it ?


Thanks !

Technical Support Jul 31, 2008 - 1:14 PM

The custom painted window captions are provided by particular paint manager versions. The size and look of caption integrated with ribbon bar is very linked with size and look of ribbon control. Increasing caption size may provide ribbon with inconsistent look. The CExtRibbonBar::RibbonLayout_GetFrameCaptionHeight() virtual method returns the height of integrated caption. You can override it and return some larger caption height. The CExtRibbonBar::NcFrameImplBridge_OnDrawCaptionText() virtual method is invoked for caption text painting.

Technical Support Jul 30, 2008 - 4:23 AM

The following code is the invocation of the CExtBitmap::LoadBMP_Resource() method:

VERIFY( pNodeOpen->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_OPEN_SMALL) ) );
But you should simply use the CExtCmdIcon::AssignFromHICON() method instead:
VERIFY( pNodeOpen->m_iconSmall.AssignFromHICON( . . . ) );