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

C / C++ / MFC

 
Generalhere is my code Pin
happy_ram12-Jun-06 21:24
happy_ram12-Jun-06 21:24 
GeneralRe: here is my code [modified] Pin
Justin Tay12-Jun-06 21:50
Justin Tay12-Jun-06 21:50 
GeneralRe: here is my code Pin
happy_ram12-Jun-06 22:34
happy_ram12-Jun-06 22:34 
GeneralRe: here is my code Pin
Justin Tay12-Jun-06 22:43
Justin Tay12-Jun-06 22:43 
GeneralRe: here is my code Pin
happy_ram12-Jun-06 22:49
happy_ram12-Jun-06 22:49 
GeneralRe: here is my code Pin
Justin Tay12-Jun-06 23:27
Justin Tay12-Jun-06 23:27 
GeneralRe: here is my code [modified] Pin
happy_ram12-Jun-06 23:45
happy_ram12-Jun-06 23:45 
GeneralRe: here is my code Pin
Justin Tay13-Jun-06 0:37
Justin Tay13-Jun-06 0:37 
The proper approach would be to write a custom control, the static picture control is not meant for anything fancy. You can think of writing a custom control as deriving from a JComponent. Wouldn't you agree that moving a JComponent around in a JDialog to achieve scrolling sounds like a bad idea (Yeah it would be nice to have something like JScrollPane in MFC)

I searched codeproject and came up with an article on writing custom controls in MFC. As a bonus the custom control is a simple control that draws a bitmap. (I tried looking for a bitmap control when you first posted but couldn't find one in the Bitmap section - probably because it's considered too simple). It also shows how you can subclass a window on a dialog using DDX.

http://www.codeproject.com/miscctrl/customcontrol.asp[^]

Of course it's a little too simple, but this can be fixed with some cut and pasting from the bitmap scrolling article. The classes he wrote for the article isn't very well designed (Unless his goal was to minimise the number of windows he creates) but it demonstrates how to draw and scroll a bitmap quite clearly. In particular take note of the OnPaint/OnVScroll/OnHScroll handlers and modify the custom control accordingly (Needs some modifications). Note that there's usually no need to create scrollbar windows. A window with the WS_HSCROLL/WS_VSCROLL style will draw a scrollbar on the sides of the window. These are so-called fake scrollbars as they don't have a window but are drawn in response to WM_NCPAINT.

http://www.codeproject.com/bitmap/bmpscroll.asp[^]

You can just tack on the OnLButtonDown/OnMouseMove/OnLButtonUp code that you've already written in the custom control and it should work as expected. As the custom control is entirely encapsulated as a window you can reuse it on dialogs and can even have it as a view on a frame.
GeneralRe: here is my code Pin
happy_ram13-Jun-06 0:45
happy_ram13-Jun-06 0:45 
GeneralRe: here is my code Pin
happy_ram13-Jun-06 1:06
happy_ram13-Jun-06 1:06 
GeneralRe: here is my code Pin
Justin Tay13-Jun-06 3:44
Justin Tay13-Jun-06 3:44 
GeneralRe: here is my code Pin
G Haranadh13-Jun-06 1:19
G Haranadh13-Jun-06 1:19 
GeneralRe: here is my code Pin
happy_ram13-Jun-06 1:23
happy_ram13-Jun-06 1:23 
AnswerRe: how we can move the bitmap when the mouse dragged Pin
khan++12-Jun-06 20:23
khan++12-Jun-06 20:23 
GeneralRe: how we can move the bitmap when the mouse dragged Pin
happy_ram12-Jun-06 20:29
happy_ram12-Jun-06 20:29 
GeneralRe: how we can move the bitmap when the mouse dragged Pin
khan++12-Jun-06 20:37
khan++12-Jun-06 20:37 
GeneralRe: how we can move the bitmap when the mouse dragged Pin
happy_ram12-Jun-06 20:47
happy_ram12-Jun-06 20:47 
GeneralRe: how we can move the bitmap when the mouse dragged Pin
khan++12-Jun-06 20:56
khan++12-Jun-06 20:56 
GeneralRe: how we can move the bitmap when the mouse dragged Pin
happy_ram12-Jun-06 21:02
happy_ram12-Jun-06 21:02 
AnswerRe: how we can move the bitmap when the mouse dragged [modified] Pin
Hamid_RT13-Jun-06 1:19
Hamid_RT13-Jun-06 1:19 
Questiondiff between win 64 and win 32 Pin
Krishnatv12-Jun-06 18:46
Krishnatv12-Jun-06 18:46 
AnswerRe: diff between win 64 and win 32 Pin
_AnsHUMAN_ 12-Jun-06 18:54
_AnsHUMAN_ 12-Jun-06 18:54 
GeneralRe: diff between win 64 and win 32 Pin
Krishnatv12-Jun-06 19:04
Krishnatv12-Jun-06 19:04 
AnswerRe: diff between win 64 and win 32 Pin
Laxman Auti12-Jun-06 19:40
Laxman Auti12-Jun-06 19:40 
AnswerRe: diff between win 64 and win 32 Pin
Eytukan12-Jun-06 23:43
Eytukan12-Jun-06 23:43 

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.