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 » Is it possible that the vista icon is used in CExtTabbedToolControlBarButtons? Collapse All
Subject Author Date
Seung Cheol Lee Aug 8, 2007 - 4:25 AM

Hi
I have two quetions.

[ First ]
I have known the Vista Icons (RGB/A 32 Bits With Alpha Channel) in CExtToolControlBar.
Now I have used the CExtTabbedToolControlBarButtons,
and I’d like to apply the vista icon to the toolbar of CExtTabbedToolControlBarButtons.
Is it possible to do that.


[ Second ]
Is it possible to change the toolbar image of CExtToolControlBar dynamically ?

Andrew Moulden Aug 27, 2007 - 11:18 AM

Just a comment about creating 32-bit BMP files from a PNG that has been created in Photoshop etc.: You don’t have to use a package such as Axialis IconWorkshop. MSPaint will do the job (on Windows XP).

1) Create your 32-bit image and save as PNG.
2) Open the PNG in MSPaint
3) Save as 24-bit BMP file

The alpha in the image won’t show in MSPaint but the full 32-bit image is saved in BMP format, including the alpha channel. It will render with alpha in a Prof-UIS CExtToolControlBar.



Technical Support Aug 28, 2007 - 1:29 PM

Yes, this is true, we have just checked this with MSPaint. Thank you for sharing this information with us.

Seung Cheol Lee Aug 8, 2007 - 5:00 AM

I found the solution of the second question.
But I didn’t find the solution of the first question.

Technical Support Aug 8, 2007 - 7:45 AM

Prof-UIS allows you to have Windows Vista quality images on any Windows OS starting from Windows 95, which is demonstrated in the FunnyBars sample. But you cannot load ICO file format with Vista icon versions. You should use 32-bit BMP files with alpha channel (they can be loaded/saved using a CExtBitmap class from Prof-UIS library) or PNG files (they can be loaded/saved using the CExtBitmapSkin class from ProfSkin library). Prof-UIS uses CExtCmdIcon objects instead of GDI icon and bitmap handles. The CExtCmdIcon class represents an icon with four states: normal (the CExtCmdIcon::m_bmpNormal bitmap), hover (the CExtCmdIcon::m_bmpHover bitmap), pressed (the CExtCmdIcon::m_bmpPressed bitmap) and disabled (the CExtCmdIcon::m_bmpDisabled bitmap). You can load each of these CExtBitmap image properties into a CExtCmdIcon object but in most cases it is enough to load only the CExtCmdIcon::m_bmpNormal bitmap (all other bitmaps are generated by a paint manager automatically). Besides, the CExtBitmap and CExtCmdIcon classes are handleless, which makes them friendly to old Windows 9x versions.

Seung Cheol Lee Aug 8, 2007 - 10:18 PM

Can you tell me how to do the vista icon of CExtTabbledToolControlBarButtons ?

For example
I used the Vista Icons in CExtToolControlBar as the below code .
================================================================================================================
CExtToolControlBar m_wndToolBarNM;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (!m_wndToolBarNM.Create (_S(IDS_STRING20491),
        this, ID_VIEW_NM_TOOLBAR,
        WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
        | CBRS_TOOLTIPS | CBRS_HIDE_INPLACE
        ) || !m_wndToolBarNM.LoadToolBar(IDR_TOOLBAR_NM_SMALL) <---- [ This is Vista Icon (32Bits) ToolBar]
    ) {
    TRACE0 ("Failed to create nm toolbar\n");
    return -1; // fail to create
}
================================================================================================================

And I used the CExtTabbledToolControlBarButtons as the below code.

================================================================================================================
CExtTabbedToolControlBarButtons m_wndTabbedBarButton;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
stat_UpdateCommandManager( m_hWnd );

if (! m_wndTabbedBarButton.Create (_S(IDS_STRING20494), this, ID_VIEW_TABBEDBAR_WHIDBEY)) {
    TRACE0("Failed to create TabbedBarButton\n");
    return -1; // fail to create
}
stat_InitializeTabbedToolControlBar( m_wndTabbedBarButton );
================================================================================================================

I don’t know tow to modify the code for using the vista icon in CExtTabbedToolControlBarButton.

My develpment Environment is Visual Studio 2005 + Windows Vista.

Technical Support Aug 9, 2007 - 12:38 PM

Your question is not related to any specific code invocations. It is related to the bitmap resource which correspond to the toolbar resource in the res folder of your project. Any version of Visual Studio supports 16/256 color toolbar resources and does not support 24/32 bit color toolbar resources. You should open your low-color toolbar bitmap in the professional Image editor like Adobe Photoshop, replace toolbar images with high quality images, save image in PNG format, open it in Axialis IconWorkshop (or other tool which able to save 32-bit BMP files with alpha channel, unfortunately MSPAINT does not support such bitmaps) and save it in BMP format. Visual studio will not work with this high quality bitmap. But Prof-UIS will load it and you will see high quality images in toolbar.

We can provide you with alternative way of constructing toolbar from PNG images directly.

Seung Cheol Lee Aug 17, 2007 - 12:26 AM

I used 32 bits color bitmap to CExtTabbedToolControlBarButtons.
But CExtTabbedToolControlBarButtons was not applied alpha channel.
I didn’t know how to apply alpha channel to CExtTabbedToolControlBarButtons

================================================================================================================
g_nGroupCC_CountOfCommands =
    stat_UpdateCommandProfileFromBitmapResource(
        strCommandProfileName,
        IDB_BITMAP_TOOLS_MEASURE1, <--- 32bits bitmap
        g_nGroupCC_FirstCmdID
    );
================================================================================================================
static void stat_AddBarIntoToolControlBar (CExtTabbedToolControlBar & _wndTabbedBar, LPCTSTR strToolBarName, UINT nFirstCmdID, UINT nCountOfCommands)
{
    HWND hWnd = _wndTabbedBar.GetSafeHwnd();
    ASSERT( hWnd != NULL && ::IsWindow(hWnd) );

    LPCTSTR strCommandProfileName = g_CmdManager->ProfileNameFromWnd( hWnd );
    ASSERT( strCommandProfileName != NULL && _tcslen(strCommandProfileName) > 0 );

    CExtToolControlBar * pToolBar = _wndTabbedBar.BarInsert( strToolBarName );
    ASSERT_VALID( pToolBar );

    UINT nCommandIndex, nCmdID = nFirstCmdID;

    for (nCommandIndex = 0; nCommandIndex < nCountOfCommands; nCommandIndex ++ ) {
        pToolBar->InsertButton ( -1, nCmdID ++, FALSE );        
    }

    pToolBar->InitContentExpandButton();
}
================================================================================================================

Technical Support Aug 20, 2007 - 5:28 AM

The CExtTabbedToolControlBar class is a control bar which contains one child tab page container window. The tab page container window is the parent of several CExtToolControlBar windows inserted into it as tab pages. The FunnyBars sample demonstrates how to use 32 bit BMP files with alpha channel as icon source for buttons in the CExtToolControlBar window. There is no difference between using 32-bit BMP files with alpha channel and any other BMP formats.

Please let us take a look at the stat_UpdateCommandProfileFromBitmapResource() function referred in your code. We guess you might load images in a not completely correct way. You can also send us your project so we can find out what may be wrong.