I am looking for .NET class which works like MFC CrectTracker. RectTracker from CodeProject is good for moving controls on the form, but I need object which moves itself over image. It should not be control itself, and should not contain other controls - exactly like MFC CRectTracker - just draws itself and handles mouse messages.
If there is such class, please post a link.
LVL 48
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMAuthor Commented:
Idle_Mind, you are invited to write this class, I know that you like such things :-)
Hello AlexFM,

you could look at the download at

hope this helps a bit

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike TomlinsonMiddle School Assistant TeacherCommented:
"I need object which moves itself over image. It should not be control itself, and should not contain other controls - exactly like MFC CRectTracker - just draws itself and handles mouse messages."

So you want to be able to draw resizeable/moveable boxes on top of a PictureBox?

Sorta like these?
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

AlexFMAuthor Commented:
Idle_Mind, this class is working, but requires a lot of client code. I am looking for something that fully encapsulates all functionality, with minimum client code.
CRectTracker has the following interface:
1) public Rectangle member which can be set and read.
2) Virtual Draw function which draws rectangle and resizing handles (both rectangle and handles are optional). Called by client from WM_PAINT handler.
3) HitTest function which detects whether tracker is clicked. Called by client from WM_MOUSEDOWN handler.
4) Track function which moves/resizes tracker. This function is called by client when HitTest is positive. Function returns when user releases mouse button. During resizing/moving CRectTracker draws itself using DrawFocusRect, without invalidating parent window.

I am looking something like this.

bruintje, my WinRar cannot open rar archive from your link. Do you have another link, or maybe you can post the code?
can post it as a zip here

still no go then i'll open it up and post here
AlexFMAuthor Commented:
Zip is OK, thanks. I will test this project.
AlexFMAuthor Commented:
Looks like something that I am looking for, I need more time for testing. I will return to this question later.
AlexFMAuthor Commented:
Life is not so easy, I spent some time with CRectTracker class. Finally I removed 70% of it's code, reduced functionality to minimum required for my case, fixed some bugs and got working version.
bruintje, thank you for the link. Idle_Mind, thank you for some ideas in your implementation.
thanks glad you got it working, hopefully it was at least easier then build from scratch :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.