Click here to Skip to main content
15,906,463 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bitmaps Pin
Christian Graus12-Nov-06 15:28
protectorChristian Graus12-Nov-06 15:28 
GeneralRe: Bitmaps Pin
BlitzPackage12-Nov-06 15:41
BlitzPackage12-Nov-06 15:41 
GeneralRe: Bitmaps Pin
Christian Graus12-Nov-06 15:45
protectorChristian Graus12-Nov-06 15:45 
GeneralRe: Bitmaps Pin
BlitzPackage12-Nov-06 15:53
BlitzPackage12-Nov-06 15:53 
GeneralRe: Bitmaps Pin
Christian Graus12-Nov-06 16:01
protectorChristian Graus12-Nov-06 16:01 
GeneralRe: Bitmaps Pin
BlitzPackage12-Nov-06 16:04
BlitzPackage12-Nov-06 16:04 
GeneralRe: Bitmaps Pin
Christian Graus12-Nov-06 16:30
protectorChristian Graus12-Nov-06 16:30 
GeneralRe: Bitmaps Pin
Mark Salsbery13-Nov-06 6:00
Mark Salsbery13-Nov-06 6:00 
Instead of converting to bitmaps (where you lose transparency) you can load them as GDI+
Bitmap objects and GDI+ will handle the alpha blending right for transparency.

As a starting point, try something like this in OnPaint or OnEraseBkgnd...wherever you're painting
a window...
HICON hIcon = ::LoadIcon(AfxGetInstanceHandle(), CResId(IDR_MAINFRAME));
Bitmap bitmap(hIcon);
Graphics graphics(*pDC);
graphics.DrawImage(&bitmap, 0, 0);
Of course, in real life you wouldn't want to reload an icon resource (or worse, bitmap from a
file) every time you paint so you'd load it once (in the window class constructor or OnCreate)
and use the same object to draw every time.

This just makes a simple test example...try it Smile | :)

To try it on PNGs and GIFs replace these lines
HICON hIcon = ::LoadIcon(AfxGetInstanceHandle(), CResId(IDR_MAINFRAME));
Bitmap bitmap(hIcon);
with
Bitmap bitmap(L"path\MyPNGFile.png", TRUE);

GeneralRe: Bitmaps Pin
BlitzPackage13-Nov-06 8:14
BlitzPackage13-Nov-06 8:14 
GeneralRe: Bitmaps Pin
Mark Salsbery13-Nov-06 8:29
Mark Salsbery13-Nov-06 8:29 
GeneralRe: Bitmaps Pin
Mark Salsbery13-Nov-06 8:33
Mark Salsbery13-Nov-06 8:33 
GeneralRe: Bitmaps Pin
BlitzPackage13-Nov-06 8:45
BlitzPackage13-Nov-06 8:45 
GeneralRe: Bitmaps Pin
Mark Salsbery13-Nov-06 9:10
Mark Salsbery13-Nov-06 9:10 
GeneralRe: Bitmaps Pin
BlitzPackage13-Nov-06 9:22
BlitzPackage13-Nov-06 9:22 
GeneralRe: Bitmaps Pin
Mark Salsbery13-Nov-06 10:54
Mark Salsbery13-Nov-06 10:54 
GeneralRe: Bitmaps Pin
BlitzPackage13-Nov-06 14:48
BlitzPackage13-Nov-06 14:48 
GeneralRe: Bitmaps Pin
Mark Salsbery13-Nov-06 15:31
Mark Salsbery13-Nov-06 15:31 
QuestionDialog help needed Pin
locoone12-Nov-06 14:40
locoone12-Nov-06 14:40 
AnswerRe: Dialog help needed Pin
BlitzPackage12-Nov-06 15:01
BlitzPackage12-Nov-06 15:01 
GeneralRe: Dialog help needed [modified] Pin
locoone12-Nov-06 16:41
locoone12-Nov-06 16:41 
GeneralRe: Dialog help needed Pin
BlitzPackage12-Nov-06 17:55
BlitzPackage12-Nov-06 17:55 
GeneralRe: Dialog help needed Pin
locoone12-Nov-06 17:57
locoone12-Nov-06 17:57 
AnswerRe: Dialog help needed Pin
BlitzPackage12-Nov-06 15:04
BlitzPackage12-Nov-06 15:04 
Questionmshflexgrid problem Pin
Tarek Jabri12-Nov-06 3:22
Tarek Jabri12-Nov-06 3:22 
AnswerRe: mshflexgrid problem Pin
S Douglas13-Nov-06 21:59
professionalS Douglas13-Nov-06 21:59 

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.