Originally posted by: Cleusewitz
Very intersted class!
Reply
Originally posted by: Christian Brandl
After using the Listbox first with a icon Imagelist and
/// #### first create a icon imagelist
/// #### replace it with bitmap imagelist
m_ImageList1 .DeleteImageList ();
HBITMAP m_BMP = NULL;
//// #### now it works fine with bitmaps
What do I wrong, because this soloution can only be a workaround.
Thanks and best regards
Hi, first I must say that I find your classes and sources
very useful and a very good base also for my apps.
I tried the CListBoxST class with icons which worked
perfect but with bitmaps there was the problem that the
height of the listbox lines did not match to the bitmap
height. It was displayed only with the height of one text line.
changing to a bitmaplist it worked fine.
m_ImageList1 .Create(40, 40, ILC_COLOR32 | ILC_MASK, 32, 1);
HICON hIcon = AfxGetApp() -> LoadIcon(IDR_MAINFRAME);
m_ImageList1 .Add(hIcon);
m_LB_ACTORS .SetImageList (&m_ImageList1);
m_ImageList1 .Create(40, 40, ILC_COLOR32 | ILC_MASK, 0, 1);
CBitmap* m_bmp;
m_BMP = (HBITMAP) LoadImage ( AfxGetInstanceHandle (), szBmpFile,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION );
if ( ! m_BMP )
m_BMP = ::LoadBitmap (AfxGetInstanceHandle (), MAKEINTRESOURCE(IDB_START) );
m_bmp = (CBitmap*) CBitmap::FromHandle(m_BMP);
imgList .Add (m_bmp, (COLORREF)0x000000);
m_bmp -> Detach ();
DeleteObject ( (HGDIOBJ) m_BMP );
m_LB_ACTORS .SetImageList (&m_ImageList1);
Christian
Originally posted by: Davide Calabro'
Why did you post your comment under CListBoxST instead of CButtonST? Also, your post seems to be truncated....
Cheers,
Davide Calabro'
http://www.softechsoftware.it
Originally posted by: Robert Space
For above, It show nothing.
// The reason:
void CButtonST::PrepareImageRect(BOOL bHasTitle, RECT* rpItem, CRect* rpTitle, BOOL bIsPressed, DWORD dwWidth, DWORD dwHeight, CRect* rpImage)
{
CRect rBtn;
rpImage->CopyRect(rpItem);
switch (m_byAlign)
{
case ST_ALIGN_HORIZ:
if (bHasTitle == FALSE)
{
// Center image horizontally
rpImage->left += ((rpImage->Width() - dwWidth)/2);
//above line, you do not check rpImage->Width() & dwWidth value, i found its value reach a large number
Originally posted by: joe zhou
Beautiful work!
Reply