Hi Sergey,
All the "Programmable Track Cursor" sample code in ChartDirector use the dynamic layer to draw things when the mouse moves over the chart. You can modify the code to draw an additional rectangle as the selection rectangle. You just need to keep track of the mouse coordinates and buttons in the drawing code, so that you know when the mouse is down and up.
When the mouse is finally up, if you would like to immediately perform something, you would need to listen to the ON_WM_LBUTTONUP message. In the attached example, I added code to listen to the ON_WM_LBUTTONUP message and forward it as a BN_UNPUSHED message to the parent dialog. In the parent dialog, I then just pop up a message box to display the selected region.
The attached example is based on the "Track Line with Data Labels (MFC)" sample code. To try the attached code, please copy them to replace the files of the same name in the "Track Line with Data Labels (MFC)" sample code in "ChartDirectormfcdemotracklabel", then compile and run the project.
Hope this can help.
Regards
Peter Kwan
|