displaying an image in a View
I have a 2 Way-Splitter Window, one side is a View, the other is a TreeCtrl.
I'm trying to drag & drop an image name from the TreeCtrl to the View, and open the image as a preview in top-left corner of the View.
But, unfortunately, my preview is not opened in my view, but in the top-left of the screen!
Does someone know how I can do?
cecile.
:) :) :) :) :) :)
Thanks for any help...
Re: displaying an image in a View
seems to me your CDC is wrong???
chrislaw
Re: displaying an image in a View
Did you forget to change client coordinates to screen coordinates?
Dave
Re: displaying an image in a View
void CGenSplitView::DrawImage (void)
{
FSSpec spec;
Rect imageRect;
NativePathNameToFSSpec ("D:\\ProgramFiles\\DevStudio\\samples\\mfc\\garden.GIF",&spec,0);
imageRect.left = 0;
imageRect.top = 0;
imageRect.right = imageRect.left + 50;
imageRect.bottom = imageRect.top + 50;
CreatePortAssociation(m_hWnd, NULL, 0);
DrawImageFile( spec, imageRect); //defined after
CWnd::UpdateWindow();
DestroyPortAssociation((CGrafPort *)GetHWNDPort(m_hWnd));
}
Here is my famous function …
As you can see, I’m using some QuickTime functions, but the problem seems to be a Windows problem.
This function is called in the TreeCtrl class through a CGenSplitView object.
You were thinking about the screen coordinates.
I have tried to call the GetWindowRect function, but it changes nothing…
But maybe, this is not the good way to do it…
If you find something wrong in my program, or some genious ideas, please let me know…
And thank you very much for your help.
Cecile.
:) :) :) :) :) :)
Thanks for any help...
Re: displaying an image in a View
I'm afraid I'm unfamiliar with QuickTime functions. I can't see anything in the code sample about display position, so unless imageRect should have screen coordinates, I can't help...
Dave