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

C / C++ / MFC

 
Questionhow we can move the bitmap when the mouse dragged Pin
happy_ram12-Jun-06 19:44
happy_ram12-Jun-06 19:44 
AnswerRe: how we can move the bitmap when the mouse dragged Pin
Laxman Auti12-Jun-06 20:16
Laxman Auti12-Jun-06 20:16 
QuestionRe: how we can move the bitmap when the mouse dragged Pin
happy_ram12-Jun-06 20:24
happy_ram12-Jun-06 20:24 
AnswerRe: how we can move the bitmap when the mouse dragged Pin
Justin Tay12-Jun-06 20:22
Justin Tay12-Jun-06 20:22 
GeneralRe: how we can move the bitmap when the mouse dragged Pin
happy_ram12-Jun-06 20:28
happy_ram12-Jun-06 20:28 
GeneralRe: how we can move the bitmap when the mouse dragged [modified] Pin
Justin Tay12-Jun-06 20:55
Justin Tay12-Jun-06 20:55 
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 
What's with all the magic numbers? What is m_bitmap and why are you using SetWindowPos? You should be writing a control that displays the bitmap and manages the scrolling by itself and this should not be part of the logic of a dialog that is containing it.

Note that point is in client coordinates and would never exceed the size of your window, so it's not particularly helpful to just set the scroll pos based on that.

void CMyBitmapView::OnMouseMove(UINT nFlags, CPoint point) 
{
  :

  if(m_bLButtonDown==true)
  {
    SetScrollPos(SB_HORZ, GetScrollPos(SB_HORZ) + m_ptPrevious.x - point.x, TRUE);
    SetScrollPos(SB_VERT, GetScrollPos(SB_VERT) + m_ptPrevious.y - point.y, TRUE);
  }

  m_ptPrevious = point;

  :
} 

Another note regarding cursors, if what you want is the arrow and hand cursors, use IDC_ARROW and IDC_HAND (IDC_HAND is available for Win2k/XP etc just set WINVER >= 0x0500 if you target Win9x as well then by all means add a hand cursor for that OS). I happen to use custom arrow and hand cursors in WinXP and I don't understand why devs feel the need to have their own special arrow and hand cursors for their applications.

-- modified at 4:07 Tuesday 13th June, 2006
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 
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 

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.