Click here to Skip to main content
15,895,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dynamically Creating code and executing it Pin
Brian V Shifrin2-Jan-02 8:21
Brian V Shifrin2-Jan-02 8:21 
GeneralRe: Dynamically Creating code and executing it Pin
Rick York2-Jan-02 8:50
mveRick York2-Jan-02 8:50 
GeneralRe: Dynamically Creating code and executing it Pin
2-Jan-02 9:28
suss2-Jan-02 9:28 
GeneralRe: Dynamically Creating code and executing it Pin
Rick York2-Jan-02 11:31
mveRick York2-Jan-02 11:31 
GeneralRe: Dynamically Creating code and executing it Pin
Carlos Antollini2-Jan-02 9:20
Carlos Antollini2-Jan-02 9:20 
GeneralRe: Dynamically Creating code and executing it Pin
Roger Wright (new)2-Jan-02 16:33
Roger Wright (new)2-Jan-02 16:33 
GeneralRe: Dynamically Creating code and executing it Pin
Todd Smith2-Jan-02 18:02
Todd Smith2-Jan-02 18:02 
GeneralCImageList & Replace with bitmap mask Pin
2-Jan-02 6:07
suss2-Jan-02 6:07 
Hello -

I'm having some novice problems with using the Replace() method of CImageList. The Add() method allows for a COLORREF to be used for the mask color, but Replace makes you supply a CBitmap for the mask.

Does the bitmap mask need to be custom generated for each bitmap that I want to insert (via Replace) into the imagelist? All of my images have a standard background color (RGB(192,192,192)), so it would be great if I could do:

m_imagelist->Replace(iOld, pNewBitMap, RGB(192,192,192));

My images are loaded into the imagelist at runtime. Other than the background color and size, I don't have any compile-time knowledge of their content.

Currently, I'm doing something like this:

void CSomeView::OnInitialUpdate()
{
...
m_imagelist.Create(16, 16, ILC_MASK | ILC_COLOR8, 0, 0);
m_imagelist.SetImageCount(20);
...
GetTreeCtrl().SetImageList(&m_imagelist, TVSIL_NORMAL);
...
}

void CSomeView::OnSomeEvent(...)
{
// IDB_MASK is a 16x16 monochrome bitmap
// that's all RGB(192,192,192)
CBitmap *pbmpMask = new CBitmap();
pbmpMask->LoadBitmap(IDB_MASK);

// load some bitmap from a file
hBitmap = (HBITMAP)::LoadImage(NULL,
strPathToTheFiles + "SomeFile.bmp",
IMAGE_BITMAP, 16, 16,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);

CBitMap *pBM = new CBitmap();
pBM->Attach(hBitmap);

m_imagelist.Replace(iSomeIndex, pBM, pbmpMask);

GetTreeCtrl().Invalidate();
}

I've tried several other approaches, but nothing gives me the transparent background. So... Do I need to build a bitmap mask for each bitmap using ::BitBlt and friends?

Thanks,
David Emery

GeneralRe: CImageList & Replace with bitmap mask Pin
Ernest Laurentin2-Jan-02 7:08
Ernest Laurentin2-Jan-02 7:08 
GeneralRe: CImageList & Replace with bitmap mask Pin
2-Jan-02 8:00
suss2-Jan-02 8:00 
GeneralRe: CImageList & Replace with bitmap mask Pin
Ernest Laurentin2-Jan-02 11:26
Ernest Laurentin2-Jan-02 11:26 
GeneralRe: CImageList & Replace with bitmap mask Pin
3-Jan-02 1:39
suss3-Jan-02 1:39 
GeneralRe: CImageList & Replace with bitmap mask Pin
Ernest Laurentin3-Jan-02 5:16
Ernest Laurentin3-Jan-02 5:16 
GeneralSkinStyle (no MFC) error: undefined reference to... Pin
Kuniva2-Jan-02 5:18
Kuniva2-Jan-02 5:18 
Generaldraw lines in a CRichEditCtrl Pin
jafrazee2-Jan-02 5:11
jafrazee2-Jan-02 5:11 
GeneralMoving and Resizing Tool Tip (CToolTipCtrl) Pin
GurGur2-Jan-02 4:30
GurGur2-Jan-02 4:30 
GeneralMultiple documents dialog box Pin
FredrikB2-Jan-02 4:09
FredrikB2-Jan-02 4:09 
GeneralVis Studio won't start add-ins Pin
2-Jan-02 3:45
suss2-Jan-02 3:45 
GeneralRe: Vis Studio won't start add-ins Pin
Lim Bio Liong2-Jan-02 17:05
Lim Bio Liong2-Jan-02 17:05 
GeneralEdit Control Pin
Ray Kinsella2-Jan-02 2:38
Ray Kinsella2-Jan-02 2:38 
GeneralRe: Edit Control Pin
Ernest Laurentin2-Jan-02 4:06
Ernest Laurentin2-Jan-02 4:06 
GeneralCReBar Pin
2-Jan-02 1:40
suss2-Jan-02 1:40 
GeneralRemoving ToolBar & Menu Pin
2-Jan-02 0:24
suss2-Jan-02 0:24 
GeneralRe: Removing ToolBar & Menu Pin
Brian V Shifrin2-Jan-02 0:41
Brian V Shifrin2-Jan-02 0:41 
GeneralRe: Removing ToolBar & Menu Pin
2-Jan-02 1:06
suss2-Jan-02 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.