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

C / C++ / MFC

 
GeneralRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
pashamsridhar16-Sep-09 19:54
pashamsridhar16-Sep-09 19:54 
GeneralRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
Stuart Dootson16-Sep-09 21:25
professionalStuart Dootson16-Sep-09 21:25 
GeneralRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
vasu_sri17-Sep-09 20:47
vasu_sri17-Sep-09 20:47 
Questionwho uses local mysql database with visual c++? Pin
includeh1016-Sep-09 3:52
includeh1016-Sep-09 3:52 
AnswerRe: who uses local mysql database with visual c++? Pin
Saurabh.Garg16-Sep-09 4:25
Saurabh.Garg16-Sep-09 4:25 
GeneralRe: who uses local mysql database with visual c++? Pin
includeh1016-Sep-09 7:46
includeh1016-Sep-09 7:46 
GeneralRe: who uses local mysql database with visual c++? Pin
Saurabh.Garg16-Sep-09 15:24
Saurabh.Garg16-Sep-09 15:24 
QuestionCreate new bitmap from oldbitmap Pin
Game-point16-Sep-09 3:18
Game-point16-Sep-09 3:18 
AnswerRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 3:28
Code-o-mat16-Sep-09 3:28 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 3:31
Game-point16-Sep-09 3:31 
GeneralRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 3:33
Code-o-mat16-Sep-09 3:33 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 3:54
Game-point16-Sep-09 3:54 
GeneralRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 4:16
Code-o-mat16-Sep-09 4:16 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 4:22
Game-point16-Sep-09 4:22 
GeneralRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 5:01
Code-o-mat16-Sep-09 5:01 
AnswerRe: Create new bitmap from oldbitmap Pin
Nuri Ismail16-Sep-09 5:02
Nuri Ismail16-Sep-09 5:02 
Hi,
I saw (from your posts) that you are using CImage class. So if you need to copy the loaded image to the new one you can use the BitBlt() method of CImage.

Here is the code fragment to create a copy of given original image:

// First load the original image
CImage imageOriginal;
imageOriginal.Load(_T("Here is the path to your original image"));

// Make a copy of the original image
CImage imageNew;
imageNew.Create(imageOriginal.GetWidth(), imageOriginal.GetHeight(), imageOriginal.GetBPP());
imageOriginal.BitBlt(imageNew.GetDC(), CPoint(0,0));
imageNew.ReleaseDC();

// Now imageNew holds the copy of original image
....


The above example makes an exact copy of the loaded image.

If you need to copy the specific part of the loaded image, for instance a rectangular part, then you can use the BitBlt() method again, but this time the code could be something like this:

// First load the original image
CImage imageOriginal;
imageOriginal.Load(_T("Here is the path to your original image"));

// Here is the rect that we will copy from the original image (in this case 1/4 of it)
CRect rectCopy(0, 0, imageOriginal.GetWidth() / 2, imageOriginal.GetHeight() / 2);
	
// Make a copy of the specific part
CImage imageNew;
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());
imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());
imageNew.ReleaseDC();

// Now imageNew holds the copy of the specific part from original image


I hope this helps! Smile | :)


Nuri Ismail

GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 20:46
Game-point16-Sep-09 20:46 
GeneralRe: Create new bitmap from oldbitmap [modified] Pin
Nuri Ismail16-Sep-09 22:04
Nuri Ismail16-Sep-09 22:04 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 22:36
Game-point16-Sep-09 22:36 
GeneralRe: Create new bitmap from oldbitmap Pin
Nuri Ismail16-Sep-09 22:50
Nuri Ismail16-Sep-09 22:50 
QuestionHow to put MFC View full screen on second monitor? Pin
Jeff Archer16-Sep-09 2:36
Jeff Archer16-Sep-09 2:36 
GeneralRe: How to put MFC View full screen on second monitor? Pin
Iain Clarke, Warrior Programmer16-Sep-09 3:20
Iain Clarke, Warrior Programmer16-Sep-09 3:20 
QuestionMFC app does not show full screen Pin
m_mun16-Sep-09 2:20
m_mun16-Sep-09 2:20 
QuestionRe: MFC app does not show full screen Pin
David Crow16-Sep-09 2:24
David Crow16-Sep-09 2:24 
AnswerRe: MFC app does not show full screen Pin
m_mun16-Sep-09 3:00
m_mun16-Sep-09 3:00 

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.