Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CListCtrl (not visible), no header? Pin
Hamid_RT22-Jan-07 5:57
Hamid_RT22-Jan-07 5:57 
GeneralRe: CListCtrl (not visible), no header? Pin
Mark Salsbery22-Jan-07 6:51
Mark Salsbery22-Jan-07 6:51 
GeneralRe: CListCtrl (not visible), no header? [modified] Pin
Cpt Rick23-Jan-07 2:40
Cpt Rick23-Jan-07 2:40 
GeneralRe: CListCtrl (not visible), no header? Pin
Mark Salsbery23-Jan-07 8:01
Mark Salsbery23-Jan-07 8:01 
QuestionMonitoring file IO like Filemon Pin
Toubou21-Jan-07 4:25
Toubou21-Jan-07 4:25 
AnswerRe: Monitoring file IO like Filemon Pin
CPallini21-Jan-07 6:27
mveCPallini21-Jan-07 6:27 
Questiongdi+ example ? Pin
s98769021-Jan-07 4:08
s98769021-Jan-07 4:08 
AnswerRe: gdi+ example ? [modified] Pin
Mark Salsbery21-Jan-07 7:53
Mark Salsbery21-Jan-07 7:53 
Bitmap class constructors will load a png image (as well as Bitmap::FromFile())
Image::RotateFlip() will rotate and/or flip
To crop, extract the desired portion from the source image into a second image (see below).
There's a Graphics::DrawImage() overload that will do just that.
Bitmap::Save() will save as any of the supported types (see below).

This sample code should be enough to get you started...
// Resize png to 320x240 bmp
// The GDI+ Bitmap class is derived from the GDI+ Image class
// I've made no assumptions on the src image dimensions
//   You should use Image::GetHeight()/Image::GetWidth() in real life :)
 
   Gdiplus::Bitmap SrcBitmap(L"C:\\test.png", FALSE);
 
   Gdiplus::Bitmap DstBitmap(320, 240, SrcBitmap.GetPixelFormat()); 
 
   Graphics DstGraphics(&DstBitmap);
   DstGraphics.DrawImage(&SrcBitmap, 0, 0, 320, 240);
 
   CLSID bmpClsid;
   GetEncoderClsid(L"image/bmp", &bmpClsid);
 
   DstBitmap.Save(L"C:\\test.bmp", &bmpClsid, NULL);

// This utility ripped right from the SDK
 
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
   UINT  num = 0;          // number of image encoders
   UINT  size = 0;         // size of the image encoder array in bytes
 
   ImageCodecInfo* pImageCodecInfo = NULL;
 
   GetImageEncodersSize(&num, &size);
   if(size == 0)
      return -1;  // Failure
  
   pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
   if(pImageCodecInfo == NULL)
      return -1;  // Failure
 
   GetImageEncoders(num, size, pImageCodecInfo);
 
   for(UINT j = 0; j < num; ++j)
   {
      if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
      {
         *pClsid = pImageCodecInfo[j].Clsid;
         free(pImageCodecInfo);
         return j;  // Success
      }    
   }
 
   free(pImageCodecInfo);
   return -1;  // Failure
}



-- modified at 14:14 Sunday 21st January, 2007
edited for splelling
AnswerRe: gdi+ example ? Pin
Mark Salsbery21-Jan-07 8:13
Mark Salsbery21-Jan-07 8:13 
AnswerRe: gdi+ example ? Pin
Hamid_RT22-Jan-07 5:46
Hamid_RT22-Jan-07 5:46 
Questionabout a = b | c | ... Pin
HOW WHAT21-Jan-07 2:50
HOW WHAT21-Jan-07 2:50 
AnswerRe: about a = b | c | ... Pin
Gary R. Wheeler21-Jan-07 3:02
Gary R. Wheeler21-Jan-07 3:02 
GeneralRe: about a = b | c | ... Pin
HOW WHAT21-Jan-07 3:19
HOW WHAT21-Jan-07 3:19 
GeneralRe: about a = b | c | ... Pin
Gary R. Wheeler21-Jan-07 4:28
Gary R. Wheeler21-Jan-07 4:28 
AnswerRe: about a = b | c | ... Pin
CPallini21-Jan-07 3:37
mveCPallini21-Jan-07 3:37 
GeneralRe: about a = b | c | ... Pin
HOW WHAT21-Jan-07 3:57
HOW WHAT21-Jan-07 3:57 
GeneralRe: about a = b | c | ... Pin
CPallini21-Jan-07 4:55
mveCPallini21-Jan-07 4:55 
QuestionSome basic Qs abt MFC,VC++,SDK.... Pin
Sameer_Thakur21-Jan-07 1:01
Sameer_Thakur21-Jan-07 1:01 
AnswerRe: Some basic Qs abt MFC,VC++,SDK.... Pin
CPallini21-Jan-07 2:02
mveCPallini21-Jan-07 2:02 
AnswerRe: Some basic Qs abt MFC,VC++,SDK.... Pin
Gary R. Wheeler21-Jan-07 2:59
Gary R. Wheeler21-Jan-07 2:59 
AnswerRe: Some basic Qs abt MFC,VC++,SDK.... Pin
Christian Graus21-Jan-07 9:36
protectorChristian Graus21-Jan-07 9:36 
QuestionHow to convert value to string in c? Pin
Agbaria Ahmad21-Jan-07 1:00
Agbaria Ahmad21-Jan-07 1:00 
AnswerRe: How to convert value to string in c? Pin
Dominik Reichl21-Jan-07 1:21
Dominik Reichl21-Jan-07 1:21 
QuestionHow to get SQL stored procedure output / return code Pin
neilsolent20-Jan-07 21:59
neilsolent20-Jan-07 21:59 
QuestionHow to SetEvenRowStyle in truedbgrid control in run time? Pin
liur1720-Jan-07 19:38
liur1720-Jan-07 19:38 

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.