Need help with CListCtrl in report mode, ImageList, CBitmap
Hi,
I am trying to modify my existing CListCtrl to display defined row
Height. For now I am using some trick and I play with custom draw and
ownerdraw fixed and it works fine except that I do not manage to handle
scrollbar properly so I have decided to use another technique.
In the case I want the same item height for all items I would like to
create an Imagelist with the specified item height.
So I have two cases :
1)List control doesn't have any icon, so we create a dummy image list
with a single transparent image
2)Control has already an image list so if specified item height is
bigger than the default item height we need to create the image list and
merge it with the current image list.
So I am starting with this :
void CListCtrlCommands::SetItemHeight(int nItemHeight)
{
if (nItemHeight > m_nItemHeight )
{
CBitmap bmp;
CImageList imgList;
CImageList* pImgList = GetImageList( LVSIL_SMALL );
if (pImgList == NULL)
{
// No existing image list
// First question how can I create a white bitmap bmp
???????
//Now create our imagelist and add our single bmp
imageList.Create(m_nItemHeight, m_nItemHeight, dwFlags , 1, 1);
imageList.Add( &bmp,(COLORREF)0xFFFFFF);
}
else
{
// Image list already exists -
// so recreate one and merge the existing
IMAGEINFO imgInfo;
pImgList->GetImageInfo(0, &imgInfo);
int nImgHeight = imgInfo.rcImage.bottom - imgInfo.rcImage.top;
?????
How can I get the current bit depth of the current image list
m_nItemHeight = nItemHeight;
}
}
So to sum up I want to create a white bitmap and to add it to an image
list and assign this image list to my listctrl.
If an imagelist is already assigned, get information from the
imagelist(depth, color mask), create a new imagelist with the specified
height and merge the new image and original one.