Click here to Skip to main content
15,892,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Replace a view in splitter window runtime. Pin
Rishav Prabhakar13-Aug-12 3:22
Rishav Prabhakar13-Aug-12 3:22 
GeneralRe: Replace a view in splitter window runtime. Pin
Richard MacCutchan13-Aug-12 3:29
mveRichard MacCutchan13-Aug-12 3:29 
QuestionHow to pan client area of a window using C++/VC++ code Pin
Member 935377612-Aug-12 23:52
Member 935377612-Aug-12 23:52 
AnswerRe: How to pan a window using C++/VC++ code Pin
pasztorpisti13-Aug-12 2:19
pasztorpisti13-Aug-12 2:19 
GeneralRe: How to pan a window using C++/VC++ code Pin
Member 935377616-Aug-12 20:17
Member 935377616-Aug-12 20:17 
AnswerRe: How to pan a window using C++/VC++ code Pin
Software_Developer13-Aug-12 8:42
Software_Developer13-Aug-12 8:42 
GeneralRe: How to pan client area of a window using C++/VC++ code Pin
Member 935377618-Aug-12 19:35
Member 935377618-Aug-12 19:35 
AnswerRe: How to pan a window using C++/VC++ code Pin
pasztorpisti13-Aug-12 11:54
pasztorpisti13-Aug-12 11:54 
I guess I know what you mean: You press down the pan mouse button while the cursor is over the view and then you pan by moving the mouse cursor until you release the pan mouse button. This panning basically scrolls the visible portion of the stuff you can see in your view. There is no API to do that, you have to implement it by yourself by handling primitive mouse events like mouse button down, mouse move, and mouse button up events. Custom implementation makes sense because its totally dependent on the program which parameters should be modified by the panning operation.
In a 2D pdf viewer the program stores some position data about which part of the pdf should be drawn to the view. This position is changed when you are panning. In a 3D CAD program there is a 3d world in which you can find an active camera as well with a position and rotation parameter (and also with horizontal and vertical fov). This camera is used by the rednerer to decide which part of the world should be rendered, the camera is like an eye and you see in the view what this eye looks at in the 3d world. This camera has an up and right direction that defines a plane. When you pan with your mouse you basically calculate a 2D offset from the mouse movement and you add this 2D offset to the camera position on the plane that is defined by the up and right vectors of the camera rotation (maybe not right but left if you are using left handed coordinate system...). Even if you are not good at 3D, the answer to your question is: Those pan functions are implemented by those programs, its custom code in them and not some operating system provided api function calls.

How to implement panning: When panning starts (mouse button down) you store the actual pan-start position of the mouse cursor, and also the position value (the 3d cam pos, or the 2d pos in the pdf file) in your program to some variables that wont change during panning. When a mouse move event comes you always calculate the delta between the pan-start mouse pos and the current moved mouse cursor pos, and you use this 2D offset to calculate the pan offset in your world (you can leave it as it is, or any simple transform can do the job, for example multiplying it with something to set panning speed...). When you have your pan offset you add the resulting pan-offset to the stored pan-start position and set the result as the current position.

The panning operation is a kind of dragging operation so you should consider implementing it with correct mouse capturing: Using SetCapture() and ReleaseCapture() correctly (usually during a drag n' drop operation).[^]
Omitting mouse capture is not the end of the world, but try to be always perfect when possible! Smile | :)
GeneralRe: How to pan a window using C++/VC++ code Pin
Member 935377613-Aug-12 20:17
Member 935377613-Aug-12 20:17 
GeneralRe: How to pan a window using C++/VC++ code Pin
pasztorpisti13-Aug-12 22:40
pasztorpisti13-Aug-12 22:40 
GeneralRe: How to pan a window using C++/VC++ code Pin
Member 935377616-Aug-12 20:16
Member 935377616-Aug-12 20:16 
GeneralRe: How to pan a window using C++/VC++ code Pin
pasztorpisti16-Aug-12 22:22
pasztorpisti16-Aug-12 22:22 
GeneralRe: How to pan client area of a window using C++/VC++ code Pin
Member 935377616-Aug-12 22:56
Member 935377616-Aug-12 22:56 
GeneralRe: How to pan client area of a window using C++/VC++ code Pin
pasztorpisti16-Aug-12 23:00
pasztorpisti16-Aug-12 23:00 
GeneralRe: How to pan client area of a window using C++/VC++ code Pin
Member 935377620-Aug-12 19:19
Member 935377620-Aug-12 19:19 
QuestionHow to change text in a text box while user is typing in another edit box in MFC.? Pin
mbatra3112-Aug-12 23:42
mbatra3112-Aug-12 23:42 
AnswerRe: How to change text in a text box while user is typing in another edit box in MFC.? Pin
Richard MacCutchan13-Aug-12 0:38
mveRichard MacCutchan13-Aug-12 0:38 
QuestionHow to generate Crystal Report in VC++ (VS2008) Pin
shiokbarnabas12-Aug-12 18:00
shiokbarnabas12-Aug-12 18:00 
AnswerRe: How to generate Crystal Report in VC++ (VS2008) Pin
Software_Developer12-Aug-12 23:18
Software_Developer12-Aug-12 23:18 
QuestionRichedit is displayed and Immediately aborts Pin
ForNow11-Aug-12 17:53
ForNow11-Aug-12 17:53 
AnswerRe: Richedit is displayed and Immediately aborts Pin
Richard MacCutchan11-Aug-12 21:44
mveRichard MacCutchan11-Aug-12 21:44 
GeneralRe: Richedit is displayed and Immediately aborts Pin
ForNow12-Aug-12 3:07
ForNow12-Aug-12 3:07 
GeneralRe: Richedit is displayed and Immediately aborts Pin
Richard MacCutchan12-Aug-12 4:01
mveRichard MacCutchan12-Aug-12 4:01 
GeneralRe: Out of Memory help Pin
ForNow12-Aug-12 12:47
ForNow12-Aug-12 12:47 
GeneralRe: Out of Memory help Pin
Bram van Kampen12-Aug-12 14:45
Bram van Kampen12-Aug-12 14:45 

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.