Available in the LEADTOOLS Imaging toolkit. |
OLEStartDrag (Main Control) example for C++ 4.0 and later
BOOL COLEDragDropDlg::OnInitDialog()
{
.
.
.
m_Lead1.Load("c:\\test.cmp",0,0,1);
return TRUE; // return TRUE unless you set the focus to a control
}
void COLEMainOCXDlg::OnStartDrag()
{
m_Lead1.SetEnableOLEDragMethod(true);
m_Lead2.SetEnableOLEDragMethod(true);
CPictureHolder PicHolder;
PicHolder.CreateFromIcon(IDR_MAINFRAME);
m_Lead1.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
m_Lead2.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
}
void COLEMainOCXDlg::OnStopDrag()
{
m_Lead1.SetEnableOLEDragMethod(false);
m_Lead2.SetEnableOLEDragMethod(false);
}
void COLEMainOCXDlg::OnLEAD1_OLEStartDrag(short Button, short Shift, long x, long y)
{
CString tmp;
tmp.Format("Drag Started at Pos (%d,%d)\n",x,y);
m_strHistory += tmp;
}
void COLEMainOCXDlg::OnLEAD1_OLECompleteDrag(short Button, short Shift, long x, long y)
{
CString tmp;
tmp.Format("Drag Complete at Pos (%d,%d)\n",x,y);
m_strHistory += tmp;
}
void COLEMainOCXDlg::OnLEAD1_OLEDragOver(short Button, short Shift, long x, long y)
{
CString tmp;
tmp.Format("Drag Over at Pos (%d,%d)\n",x,y);
m_strHistory += tmp;
}
void COLEMainOCXDlg::OnLEAD1_OLEGiveFeedback(BOOL FAR* pbUseDefaultCursor)
{
*pbUseDefaultCursor = false;
}
void COLEMainOCXDlg::OnLEAD2_OLEGiveFeedback(BOOL FAR* pbUseDefaultCursor)
{
*pbUseDefaultCursor = false;
}
void COLEMainOCXDlg::OnHistory()
{
MessageBox(m_strHistory);
}