Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Drawing a Picture
Author:Arkon
Category:Win32API
File Size:643 Bytes
Uploaded at:19-Aug-06 06:57:28 am
Description:
  With GDI+ it's very easy to load and draw any image format (BMP, ICON, GIF, JPEG, Exif, PNG, TIFF, WMF, and EMF).
  
#pragma comment(lib, "gdiplus.lib")
#include <windows.h>
#include <gdiplus.h>

using namespace Gdiplus;

GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;

void initGdiPlus()
{
  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
}

void OnPaint(HDC hDC)
{
  Graphics graphics(hdc);
  Image image(L"untitled.jpg");
  // If you have the raw data of the image for some reason,
  // use the other snippet for making it an IStream
  // And use the Image constructor which recieves an IStream.
  graphics.DrawImage(&image, Point(0, 0));
}

void destroyGdiPlus()
{
  GdiplusShutdown(gdiplusToken);
}
User Contributed Comments(1)
 [1] Sanjeev | 2012-05-22 04:57:16

After Drawing a Picture on a window, I want to delete the picture from on that window. So can you tell me how can i do this?
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[106235]
2D Rotated Rectangles Collision Detection[79393]
Keyboard Hook[68783]
UDP[52867]
HTTP Proxy[36098]

::Top 5 Samples::
2D ColDet Rotated Rectangles[10613]
PS2 Mouse Driver[6098]
Wave Format Player[4984]
Reading FAT12[4870]
CodeGuru[4561]


All rights reserved to RageStorm © 2009