Line tracker class similar to CRectTracker
Line tracker class (KLineTracker) that I present here performs dragging and resizing of lines with left mouse button. It does for lines the same thing CRectTracker does for rectangles.
When I needed to add to my application possibility to draw, move and resize lines using mouse, I looked for line tracker class in MFC. Because I used CRectTracker for resizing and moving rectangles, I expected to see CLineTracker for moving and resizing lines. But unfortunately I did not find one. Then I went to the Internet (Deja News, Alta Vista, InfoSeek, etc.), but they did not give me the answer too. The only thing I saw were requests for line tracker class from other people.
In the end, I decided to write line tracker class myself. I choose name KLineTracker instead of CLineTracker, so that if CLineTracker class will be sometimes added to MFC, my program will not run into clash.
Usage of the class is very similar to that of CRectTracker. Details should be obvious from the demo project (look at TrackerWnd.cpp). Suggessions for changes, improvements and bug reports are welcome. Although, I don't promise to fix all the bugs fast :-).

Comments
How can I use it with CScrollView?
Posted by Legacy on 06/18/2003 12:00amOriginally posted by: Tran Cong Khanh
KLineTracker class is great!. But it doesn't care about scrolling. So when using it with CScollView, what additional code I must add?
Replyi thik KLineTracker can be created dynamically.
Posted by Legacy on 01/20/2002 12:00amOriginally posted by: JinSoo
Hello!!! Ivan.
My name is JinSoo.
I am Korean. I am now using your KLineTracker From CodeGuru.
when i create dynamically the KLineTracker , A Strange thing occured.
and when i also delete the KLineTracker. An Error occured.
i thik KLineTracker can be created dynamically.
I hope you thai i can create and delete dynamically the KLineTracker.
please, have a nice day. and Good Answer !!!
ReplyWould't it be great if it was resizable ?
Posted by Legacy on 07/21/1999 12:00amOriginally posted by: George Sgouros
First of all congratulations to Ivan for this excellent
piece of code.
I only have a request :
I really need this control to be resizable.
If the control had something like an OnSize handler
AND it could use the client area of a Static control,
then I guess everything would not be so difficult
(I could use cdxCSizingDialog classes (described elswhere in Code Guru ) to resize the static control and hopefully
the line tracker control should resize as well.
However , being a newbie, I cannot yet add this functionality on my own.
To be more specific :
1. I cannot make TrackerWnd use the client area of a static control that is binded with a CStatic variable (I get an assertion during subclassing. CStatic variable declaration is necessary for using cdx... resizing classes)
2. I do not know what exactly should I write inside the OnSize() handler.
So, any suggestions on this issues would be highly appreciated.
Best regards
George
ReplyBUG: when input canceled, temp rubber line stays visible
Posted by Legacy on 06/22/1999 12:00amOriginally posted by: Vadim Mikhailov
ReplyNot release GDI resourses
Posted by Legacy on 04/03/1999 12:00amOriginally posted by: Fabian
Actully if you are using
pDC->SaveDC
the correct way should be
int oldDC = pDC->SaveDC();
...
pDC->RestoreDC(oldDC);
and also the GDI objects should be delete to avoid resuorces leaking
LinePen.DeleteObject();
HandleBrush.DeleteObject();
Anyway, the KLineTracker is very nice and handy.
Thank Ivan.
ReplyFabian
when line is moved, original line is erased.
Posted by Legacy on 03/08/1999 12:00amOriginally posted by: Kang Seung Bum
When LineTracker is moving, or resizing, original line is erased!!
ReplyIs there solution?
No viruses reported in Demo project when checked by McAfee NTScan
Posted by Legacy on 11/14/1998 12:00amOriginally posted by: Ivan Krivyakov
ReplyWebScan alert for a virus on .EXE file
Posted by Legacy on 11/13/1998 12:00amOriginally posted by: Davide Zaccanti
I don't known if this is true, but I've avoided to download demo project.
Reply