Click here to Skip to main content
15,912,069 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Cannot get the correct cursor position in picture control Pin
Code-o-mat4-Feb-09 5:36
Code-o-mat4-Feb-09 5:36 
QuestionRe: Cannot get the correct cursor position in picture control Pin
z01e4-Feb-09 5:56
z01e4-Feb-09 5:56 
AnswerRe: Cannot get the correct cursor position in picture control Pin
Code-o-mat4-Feb-09 6:10
Code-o-mat4-Feb-09 6:10 
GeneralRe: Cannot get the correct cursor position in picture control Pin
z01e4-Feb-09 6:25
z01e4-Feb-09 6:25 
GeneralRe: Cannot get the correct cursor position in picture control Pin
Code-o-mat4-Feb-09 6:43
Code-o-mat4-Feb-09 6:43 
QuestionRe: Cannot get the correct cursor position in picture control Pin
z01e4-Feb-09 7:11
z01e4-Feb-09 7:11 
AnswerRe: Cannot get the correct cursor position in picture control Pin
Code-o-mat4-Feb-09 7:59
Code-o-mat4-Feb-09 7:59 
GeneralRe: Cannot get the correct cursor position in picture control Pin
z01e4-Feb-09 8:42
z01e4-Feb-09 8:42 
still doesnt work - -
but thank you very much

i load image by using this.

void CPictureBox::ShowBitmap(CPaintDC *pdc)
{
//Create a device context to load the bitmap into
CDC dcMem;
dcMem.CreateCompatibleDC(pdc);

//Get the Display area available
CRect lRect;
GetClientRect(lRect);
lRect.NormalizeRect();

//select the bitmap into compatible device context
CBitmap* pOldBitmap = (CBitmap*)dcMem.SelectObject(&m_bmpBitmap);
//m_bmpBitmap.SetBitmapDimension(lRect.Width(),lRect.Height());

//copy & resize the window to the dialog window
pdc->StretchBlt(0,0,lRect.Width(),lRect.Height(),&dcMem,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
}
void CPictureBox::OnPaint()
{
CPaintDC dc(this); // device context for painting

RECT rect;
GetClientRect(&rect);
dc.FillSolidRect(&rect, RGB(255,255,255));

if(m_sBitmap!="")
ShowBitmap(&dc);
}
void CPictureBox::SetBitmap(CString strBitmap)
{
m_sBitmap = strBitmap;

HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_sBitmap, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);

// Do we have a valid handle for the loaded image?
if (hBitmap)
{
// Delete the current bitmap
if (m_bmpBitmap.DeleteObject())
m_bmpBitmap.Detach(); // If there was a bitmap, detach it
// Attach the currently loaded bitmap to the bitmap object
m_bmpBitmap.Attach(hBitmap);
}
m_bmpBitmap.GetBitmap(&bm); //Get Bitmap Structure
Invalidate();
}

maybe this is why it doesn't work.and i dont know what should i do with it to make this work. T_T

anyway thanks to you.
GeneralRe: Cannot get the correct cursor position in picture control Pin
Code-o-mat4-Feb-09 10:12
Code-o-mat4-Feb-09 10:12 
GeneralRe: Cannot get the correct cursor position in picture control Pin
z01e4-Feb-09 23:05
z01e4-Feb-09 23:05 
QuestionMemory Leak Pin
rr_ramesh714-Feb-09 1:37
rr_ramesh714-Feb-09 1:37 
QuestionRe: Memory Leak Pin
prasad_som4-Feb-09 1:42
prasad_som4-Feb-09 1:42 
AnswerRe: Memory Leak Pin
rr_ramesh714-Feb-09 2:18
rr_ramesh714-Feb-09 2:18 
GeneralRe: Memory Leak Pin
Cedric Moonen4-Feb-09 2:37
Cedric Moonen4-Feb-09 2:37 
AnswerRe: Memory Leak Pin
prasad_som4-Feb-09 3:32
prasad_som4-Feb-09 3:32 
AnswerRe: Memory Leak Pin
Stuart Dootson4-Feb-09 1:43
professionalStuart Dootson4-Feb-09 1:43 
AnswerRe: Memory Leak Pin
Cedric Moonen4-Feb-09 1:46
Cedric Moonen4-Feb-09 1:46 
GeneralRe: Memory Leak Pin
Code-o-mat4-Feb-09 2:25
Code-o-mat4-Feb-09 2:25 
Questiontesting a ini file in vc++6 Pin
hrishiS4-Feb-09 1:26
hrishiS4-Feb-09 1:26 
AnswerRe: testing a ini file in vc++6 Pin
prasad_som4-Feb-09 1:39
prasad_som4-Feb-09 1:39 
GeneralRe: testing a ini file in vc++6 Pin
hrishiS4-Feb-09 2:47
hrishiS4-Feb-09 2:47 
GeneralRe: testing a ini file in vc++6 Pin
krmed4-Feb-09 2:54
krmed4-Feb-09 2:54 
GeneralRe: testing a ini file in vc++6 Pin
hrishiS4-Feb-09 3:01
hrishiS4-Feb-09 3:01 
QuestionRe: testing a ini file in vc++6 Pin
David Crow4-Feb-09 3:14
David Crow4-Feb-09 3:14 
AnswerRe: testing a ini file in vc++6 Pin
hrishiS4-Feb-09 3:58
hrishiS4-Feb-09 3:58 

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.