Click here to Skip to main content
15,910,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcontext and winhelp menus not staying in foreground Pin
raultkd3-Oct-04 16:45
raultkd3-Oct-04 16:45 
QuestionI'm floating integer to hex? Pin
BOBOBOBOBS3-Oct-04 15:53
BOBOBOBOBS3-Oct-04 15:53 
AnswerRe: I'm floating integer to hex? Pin
ThatsAlok3-Oct-04 19:09
ThatsAlok3-Oct-04 19:09 
AnswerRe: I'm floating integer to hex? Pin
mirex4-Oct-04 2:40
mirex4-Oct-04 2:40 
GeneralHelp Pin
Anonymous3-Oct-04 14:22
Anonymous3-Oct-04 14:22 
GeneralRe: Help Pin
ThatsAlok3-Oct-04 20:36
ThatsAlok3-Oct-04 20:36 
GeneralExtract HBITMAP from IMAGELIST icon Pin
peterchen3-Oct-04 14:15
peterchen3-Oct-04 14:15 
GeneralRe: Extract HBITMAP from IMAGELIST icon Pin
PJ Arends3-Oct-04 16:24
professionalPJ Arends3-Oct-04 16:24 
I do it by creating a new bitmap the same size as an icon in the image list, do a FillRect() with the background colour, then Draw() the icon on it.

CBitmap *CMyImageList::GetBitmap(int index, CSize size, COLORREF clrBkGrnd)
{
  int count = GetImageCount();
 
  if (!(index < count && index >= 0))
    return NULL;
 
  IMAGEINFO info = {0};
  GetImgeInfo(index, &info);
  CSize ImageSize(info.rcImage.right - info.rcImage.left,
                  info.rcimage.bottom - info.rcImage.top);
 
  int x = 0;
  int y = 0;
 
  if (size.cx != ImageSize.cx)
    x = (size.cx - ImageSize.cx) / 2;
 
  if (size.cy != ImageSize.cy)
    y = (size.cy - ImageSize.cy) / 2;
 
  CBitmap *pbmp = NULL;
  CDC DC;
  if (DC.CreateCompatibleDC(NULL))
  {
    int saved = DC.saveDC();
    pbmp = new CBitmap;
    if (pbmp)
    {
      if (pbmp->CreateCompatibleBitmap(NULL, size.cx, size.cy))
      {
        if (DC.SelectObject(pbmp))
        {
          DC.FillSilidRect(0, 0, size.cx, size.cy, clrBkGrnd);
          Draw(&DC, index, CPoint(x, y), ILD_NORMAL);
        }
      }
    }
    DC.RestoreDC(saved);
  }
 
  return pbmp;
}




"You're obviously a superstar." - Christian Graus about me - 12 Feb '03

"Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04

Within you lies the power for good - Use it!
GeneralMFC Progress Bar Pin
Anonymous3-Oct-04 11:59
Anonymous3-Oct-04 11:59 
GeneralRe: MFC Progress Bar Pin
ThatsAlok3-Oct-04 19:25
ThatsAlok3-Oct-04 19:25 
GeneralRe: MFC Progress Bar Pin
pubududilena4-Oct-04 0:06
pubududilena4-Oct-04 0:06 
QuestionWinVerifyTrust on legacy Win9x? Pin
Jason De Arte3-Oct-04 10:36
Jason De Arte3-Oct-04 10:36 
AnswerRe: WinVerifyTrust on legacy Win9x? Pin
Jason De Arte3-Oct-04 17:01
Jason De Arte3-Oct-04 17:01 
Generalresource is open in another editor Pin
Anonymous3-Oct-04 10:08
Anonymous3-Oct-04 10:08 
GeneralRe: resource is open in another editor Pin
pubududilena3-Oct-04 21:07
pubududilena3-Oct-04 21:07 
GeneralPopup inside popup Pin
Kamis3-Oct-04 9:21
Kamis3-Oct-04 9:21 
GeneralRe: Popup inside popup Pin
Michael Dunn3-Oct-04 10:37
sitebuilderMichael Dunn3-Oct-04 10:37 
GeneralRe: Popup inside popup Pin
Kamis3-Oct-04 11:12
Kamis3-Oct-04 11:12 
GeneralCompile HTML Files Pin
Azghar Hussain3-Oct-04 7:33
professionalAzghar Hussain3-Oct-04 7:33 
GeneralRe: Compile HTML Files Pin
Ravi Bhavnani3-Oct-04 7:51
professionalRavi Bhavnani3-Oct-04 7:51 
GeneralRe: Compile HTML Files Pin
Azghar Hussain4-Oct-04 7:43
professionalAzghar Hussain4-Oct-04 7:43 
GeneralDialog Box Pin
ANDYFA3-Oct-04 6:33
ANDYFA3-Oct-04 6:33 
GeneralRe: Dialog Box Pin
Yulianto.3-Oct-04 18:55
Yulianto.3-Oct-04 18:55 
GeneralRe: Dialog Box Pin
ANDYFA4-Oct-04 12:09
ANDYFA4-Oct-04 12:09 
GeneralRe: Dialog Box Pin
Yulianto.4-Oct-04 15:11
Yulianto.4-Oct-04 15:11 

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.