Win32工具栏和24bit图片 [英] Win32 Toolbars and 24bit Images

查看:233
本文介绍了Win32工具栏和24bit图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WinAPI是否支持24位+图像?我想使用24bit图标(更多的定义)作为工具栏按钮图像。我已经加载图标像这样:

Does the WinAPI support 24bit+ images? I would like to use 24bit icons( more definition ) as toolbar button images. I've loaded the icon's like this:

// create toolbar
HWND hTool = CreateWindowEx( 0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
                        m_hWnd[ AUXILIARY_VIEWPORT ], ( HMENU )IDC_TEX_TOOL, GetModuleHandle( NULL ), NULL );

// Send the TB_BUTTONSTRUCTSIZE message, which is required for backward compatibility.
SendMessage( hTool, TB_BUTTONSTRUCTSIZE, ( WPARAM )sizeof( TBBUTTON ), 0 );
SendMessage( hTool, TB_SETBUTTONSIZE, 0, MAKELPARAM( 32, 32 ) );
SendMessage( hTool, TB_SETBITMAPSIZE, 0, MAKELPARAM( 32, 32 ) );

// declare button and bitmap structs
TBBUTTON tbb[ 19 ];
TBADDBITMAP tbab;

HICON hIcon = ( HICON )LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_GRADIENT ) );

// create and add imagelist

HIMAGELIST hImgList = ImageList_Create( 32, 32, ILC_MASK, 1, 1 );
int nR = ImageList_AddIcon( hImgList, hIcon );
SendMessage( hTool, TB_SETIMAGELIST, 0, ( LPARAM )hImgList);

ZeroMemory( tbb, sizeof( tbb ) );
tbb[ 0 ].iBitmap = 0;
tbb[ 0 ].fsState = TBSTATE_ENABLED;
tbb[ 0 ].fsStyle = BTNS_CHECK;
tbb[ 0 ].idCommand = IDM_EDITTEXTURE_ENABLE;
    ...
SendMessage( hTool, TB_ADDBUTTONS, SIZEARRAY( tbb ), ( LPARAM )&tbb );

载入时图像似乎转换为16位...如何使用高分辨率图像

The images seem to be converted to 16bit when loaded...How can I use high res images on buttons?

推荐答案

查看此处可获得全功能的24位彩色工具栏。

Check out here to get the full-featured 24-bit color toolbar. It also contains a demo solution there.

主要想法是使用:

static const UINT   kToolBarBitDepth (ILC_COLOR24);

这篇关于Win32工具栏和24bit图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆