// Load the image Bitmap* image = lpData->docklet->LoadGDIPlusImage(path); // replace this by a call to the LoadGDIPlusImage function from the SDK if (image != NULL) { // Get the background color Color* background = new Color(); background->SetFromCOLORREF(GetSysColor(COLOR_BTNFACE)); // Create the bitmap Bitmap bitmap(image->GetHeight(),image->GetWidth()); Graphics bitmapGraphics(&bitmap); SolidBrush solidBrush(*background); bitmapGraphics.FillRectangle(&solidBrush, 0, 0, image->GetHeight(), image->GetWidth()); bitmapGraphics.DrawImage(image,0,0,image->GetHeight(),image->GetWidth()); Bitmap* icon = (Bitmap*)bitmap.GetThumbnailImage(size,size,NULL,NULL); HBITMAP hBitmap; icon->GetHBITMAP(*background, &hBitmap); // Display the image SendDlgItemMessage(hDlg, ID_DIALOG, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM) hBitmap); delete(icon); delete(background); } delete(image);
Sign Up or Login and this ad disappears! There are many great features available to you once you register. Sign Up for a free account and browse the forums without ads.
There are many great features available to you once you register, including:
Sign in or Create Account