class LboxImagelist

  コンストラクタ



  
ビルド時に、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;
	}
}
  



  Create



  
// *********************************************************
// イメージリスト作成
// 戻り値 : 無し
// *********************************************************
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;
}
  



  CreateSystemFile

  
// *********************************************************
// システムイメージリスト作成
// 戻り値 : 無し
// *********************************************************
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;
}
  



  Add

  
// *********************************************************
// イメージ追加
// 戻り値 : 無し
// *********************************************************
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 );
}
  



  RemoveAll

  
// *********************************************************
// イメージを全て削除
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::RemoveAll( void )
{
	if ( LboxImagelist::hImgList == NULL ) {
		return;
	}
	if ( (LboxImagelist::bSystem) ) {
		return;
	}

	ImageList_RemoveAll( LboxImagelist::hImgList );	
}
  



  Remove

  
// *********************************************************
// 指定イメージを削除
// 戻り値 : 無し
// *********************************************************
void LboxImagelist::Remove( int i )
{
	if ( LboxImagelist::hImgList == NULL ) {
		return;
	}
	if ( (LboxImagelist::bSystem) ) {
		return;
	}

	ImageList_Remove( LboxImagelist::hImgList, i );
}
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ