CRectTracker movement

Posted on 1999-11-09
Medium Priority
Last Modified: 2013-11-20
How do i restrict the rectangle of a CRectTrack to move in horizontal direction only when the user LButtonDown on the rectangle and drags it  around?

I have managed to set the rectangle to 'Track' the mouse on LButton down.  What should i do after that?

Question by:leowlf

Expert Comment

ID: 2194069
In the OnLButtonDown handler store the current vertical offset. Override the OnMouseMove message handler and change the value back to this stored offset before passing it through to the base class implimentation.

Accepted Solution

olgat earned 150 total points
ID: 2194183
Derive your class from CRectTracker.
In your derived class override DrawTrackerRect(LPCRECTlpRect,...) method.
The default implementation of this method makes a call to CDC::DrawFocusRect, which draws a dotted rectangle.
In your overriden method you can do this call with lpRect.top and lpRect.bottom always changed to whatever you want them to be.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question