|
|
ビルド時に、comctl32.lib が必要になります
| |
|
|
// *********************************************************
// デフォルトコンストラクタ
// *********************************************************
LboxImagelist::LboxImagelist()
{
LboxImagelist::hImgList = NULL;
LboxImagelist::bSystem = false;
}
// *********************************************************
// デストラクタ
// *********************************************************
LboxImagelist::~LboxImagelist()
{
if ( LboxImagelist::hImgList != NULL ) {
if ( LboxImagelist::bSystem == false ) {
ImageList_Destroy( LboxImagelist::hImgList );
}
LboxImagelist::bSystem = false;
}
}
| |
|
|
|
|
// *********************************************************
// イメージリスト作成
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::Create(int cx,int cy)
{
if ( LboxImagelist::hImgList != NULL ) {
if ( LboxImagelist::bSystem == false ) {
ImageList_Destroy( LboxImagelist::hImgList );
}
}
LboxImagelist::hImgList =
ImageList_Create(
cx, cy,
ILC_COLOR | ILC_MASK,
5, 5
);
LboxImagelist::bSystem = false;
}
| |
|
|
|
|
// *********************************************************
// システムイメージリスト作成
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::CreateSystemFile( void )
{
if ( LboxImagelist::hImgList != NULL ) {
if ( LboxImagelist::bSystem == false ) {
ImageList_Destroy( LboxImagelist::hImgList );
}
}
SHFILEINFO sfi;
LboxImagelist::hImgList = (HIMAGELIST)SHGetFileInfo(
".",
NULL,
&sfi,
sizeof( SHFILEINFO ),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON
);
LboxImagelist::bSystem = true;
}
| |
|
|
|
|
// *********************************************************
// イメージ追加
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::Add( HWND hWnd, int nID, int r, int g, int b )
{
if ( LboxImagelist::hImgList == NULL ) {
return;
}
if ( (LboxImagelist::bSystem) ) {
return;
}
HBITMAP hBitmap;
hBitmap = LoadBitmap(
LboxGetInstance( hWnd ),
MAKEINTRESOURCE( nID )
);
if ( hBitmap == NULL ) {
return;
}
ImageList_AddMasked(
LboxImagelist::hImgList,
hBitmap,
RGB(r,g,b)
);
DeleteObject( hBitmap );
}
| |
|
|
|
|
// *********************************************************
// イメージを全て削除
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::RemoveAll( void )
{
if ( LboxImagelist::hImgList == NULL ) {
return;
}
if ( (LboxImagelist::bSystem) ) {
return;
}
ImageList_RemoveAll( LboxImagelist::hImgList );
}
| |
|
|
|
|
// *********************************************************
// 指定イメージを削除
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::Remove( int i )
{
if ( LboxImagelist::hImgList == NULL ) {
return;
}
if ( (LboxImagelist::bSystem) ) {
return;
}
ImageList_Remove( LboxImagelist::hImgList, i );
}
| |
|
|
|