1、 picture 控件画矩形可以任意拖动

解决方案 »

  1.   

    CRectTracker m_Tracker;
    #define TRACK_SIZE 128void CPartialBitmapView::OnInitialUpdate()
    {
    CView::OnInitialUpdate();
    //
    CRect rc;
    GetClientRect(&rc);
    CPoint pt=rc.CenterPoint();
    rc.left=pt.x-TRACK_SIZE/2;
    rc.right=pt.x+TRACK_SIZE/2;
    rc.top=pt.y-TRACK_SIZE/2;
    rc.bottom=pt.y+TRACK_SIZE/2;
    m_Tracker.m_rect=rc;
    m_Tracker.m_nStyle |= CRectTracker::solidLine;
    m_Tracker.m_nStyle |= CRectTracker::resizeInside; 
    }
      

  2.   

    Implementing Activation by Using a Mouse Click
      

  3.   

    GreenOpenPaint的实现(五)矩形框
    http://www.cnblogs.com/jsxyhelu/p/6354341.html已经完全实现带代码,只是需要你去读懂。
      

  4.   

    听说PhotoShop 1.0的源代码都公开了!
      

  5.   

    crecttraker可以去研究下,跟微软的一样带8个小爪
      

  6.   

    CRectTracker
    CRectTracker does not have a base class.The CRectTracker class allows an item to be displayed, moved, and resized in different fashions. Although the CRectTracker class is designed to allow the user to interact with OLE items by using a graphical interface, its use is not restricted to OLE-enabled applications. It can be used anywhere such a user interface is required. CRectTracker borders can be solid or dotted lines. The item can be given a hatched border or overlaid with a hatched pattern to indicate different states of the item. You can place eight resize handles on either the outside or the inside border of the item. (For an explanation of the resize handles, see GetHandleMask.) Finally, a CRectTracker allows you to change the orientation of an item during resizing. To use CRectTracker, construct a CRectTracker object and specify which display states are initialized. You can then use this interface to give the user visual feedback on the current status of the OLE item associated with the CRectTracker object. For more information on using CRectTracker, see the articleTrackers in Visual C++ Programmer’s Guide.#include <afxext.h>Class Members |  Hierarchy ChartSamples   MFC Sample TRACKER | MFC Sample DRAWCLISee Also   COleResizeBar, CRect, CRectTracker::GetHandleMask