Click here to Skip to main content
15,894,630 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Writing/reading to/from CSV files Pin
J_E_D_I14-May-07 4:18
J_E_D_I14-May-07 4:18 
GeneralRe: Writing/reading to/from CSV files Pin
David Crow14-May-07 4:26
David Crow14-May-07 4:26 
QuestionRuntime error for OpenFileDialog Class in .NET 2005 Pin
priyank_ldce13-May-07 5:45
priyank_ldce13-May-07 5:45 
AnswerRe: Runtime error for OpenFileDialog Class in .NET 2005 Pin
Mark Salsbery13-May-07 5:54
Mark Salsbery13-May-07 5:54 
AnswerRe: Runtime error for OpenFileDialog Class in .NET 2005 Pin
Michael Dunn13-May-07 6:15
sitebuilderMichael Dunn13-May-07 6:15 
GeneralRe: Runtime error for OpenFileDialog Class in .NET 2005 Pin
Stephen Hewitt13-May-07 18:52
Stephen Hewitt13-May-07 18:52 
AnswerRe: Runtime error for OpenFileDialog Class in .NET 2005 Pin
Stephen Hewitt13-May-07 18:57
Stephen Hewitt13-May-07 18:57 
QuestionATL::CImage using HDC ??? Pin
guybour200613-May-07 4:33
guybour200613-May-07 4:33 
I am using Visual Studio 2005, with Visual C++, and have generated a single docuemnt project with mainframe and childview for MFC.

I want to display parts of an image that the program loads from a bitmap file, on a grid pattern as produced by CGrid class in Grid.h and Grid.cpp.

When I use the StretchBlt function, the program asks for a HDC!!!!

I have not found litterature or samples for the use of that device context.

Would you know of a solution?

Thanks for any help....


Here is a possible code section for my function. With it, I can enter a string but not the image. It creates a CDC* but not a HDC. How should I code the HDC?????

void CGrid::FillCell(int r, int c, CString val, COLORREF brushColor, CImage m_Image)
{

CWnd* pWnd = AfxGetMainWnd();
CDC* pDC = pWnd->GetDC();
// pDC->BitBlt(0,0,20,20,pDC,0,0,SRCCOPY);


CBrush* pBrush;
pBrush = new CBrush (brushColor);
pDC->FillRect (mGrid[r][c],pBrush );
delete pBrush;

pDC->SetBkMode (TRANSPARENT);
pDC->SetTextColor (mStringColor);
pDC->DrawText(val,-1,mGrid[r][c],
DT_SINGLELINE |
DT_CENTER |
DT_VCENTER
);

// m_Image.StretchBlt(pDC,mGrid[r][c].TopLeft().x,mGrid[r][c].TopLeft().y,mGrid[r][c].Width(),mGrid[r][c].Height(),mGrid[r][c].TopLeft().x,mGrid[r][c].TopLeft().y,mGrid[r][c].Width(),mGrid[r][c].Height(),SRCCOPY);

// pDC->StretchBlt(mGrid[r][c].TopLeft().x,mGrid[r][c].TopLeft().y,mGrid[r][c].Width(),mGrid[r][c].Height(),m_Image,mGrid[r][c].TopLeft().x,mGrid[r][c].TopLeft().y,mGrid[r][c].Width(),mGrid[r][c].Height(),SRCCOPY);
pWnd->ReleaseDC(pDC);
}


guybour
AnswerRe: ATL::CImage using HDC ??? Pin
Mark Salsbery13-May-07 5:45
Mark Salsbery13-May-07 5:45 
AnswerRe: ATL::CImage using HDC ??? Pin
bob1697213-May-07 7:46
bob1697213-May-07 7:46 
QuestionStrange strcpy problem Pin
Axonn Echysttas13-May-07 2:17
Axonn Echysttas13-May-07 2:17 
AnswerRe: Strange strcpy problem Pin
Gary R. Wheeler13-May-07 2:31
Gary R. Wheeler13-May-07 2:31 
GeneralRe: Strange strcpy problem Pin
Axonn Echysttas13-May-07 3:09
Axonn Echysttas13-May-07 3:09 
GeneralRe: Strange strcpy problem Pin
Hans Dietrich13-May-07 3:47
mentorHans Dietrich13-May-07 3:47 
GeneralRe: Strange strcpy problem Pin
Axonn Echysttas13-May-07 4:17
Axonn Echysttas13-May-07 4:17 
GeneralRe: Strange strcpy problem Pin
Gary R. Wheeler13-May-07 4:32
Gary R. Wheeler13-May-07 4:32 
AnswerRe: Strange strcpy problem Pin
Michael Dunn13-May-07 6:18
sitebuilderMichael Dunn13-May-07 6:18 
QuestionMapping a drive into memory. Pin
Killer22512-May-07 23:23
Killer22512-May-07 23:23 
AnswerRe: Mapping a drive into memory. Pin
Hans Dietrich13-May-07 0:10
mentorHans Dietrich13-May-07 0:10 
AnswerRe: Mapping a drive into memory. Pin
Michael Dunn13-May-07 6:20
sitebuilderMichael Dunn13-May-07 6:20 
Questionvc++ related to xml Pin
biswajit nayak12-May-07 21:46
biswajit nayak12-May-07 21:46 
AnswerRe: vc++ related to xml Pin
Cedric Moonen12-May-07 22:01
Cedric Moonen12-May-07 22:01 
GeneralRe: vc++ related to xml Pin
Hans Dietrich13-May-07 0:12
mentorHans Dietrich13-May-07 0:12 
AnswerRe: vc++ related to xml Pin
Hamid_RT13-May-07 1:21
Hamid_RT13-May-07 1:21 
AnswerRe: vc++ related to xml Pin
#realJSOP13-May-07 3:57
mve#realJSOP13-May-07 3:57 

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.