OLEDragDrop

出自VFP Wiki

(修訂版本間差異)
跳轉到: 導航, 搜尋

在2006年10月3日 (二) 09:02的最新修訂版本


OLEDragDrop

*
* 可以將任何"文字" "拉到"buttom上變成buttom的名稱 
*
local lo_form
lo_form=createobject("w_form1")
lo_form.show()
read event

DEFINE CLASS w_form1 AS form
DoCreate = .T.
Name = "W_form1"
AlwaysOnTop = .T.

ADD OBJECT command1 AS commandbutton WITH ;
OLEDropMode = 1, ;
Top = 48, ;
Left = 72, ;
Height = 133, ;
Width = 229, ;
Caption = "Command1", ;
Name = "Command1"


PROCEDURE command1.OLEDragDrop
Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
If oDataObject.GetFormat(1) && 1=text
This.Caption=oDataObject.GetData(1)
Endif
ENDPROC


PROCEDURE command1.OLEDragOver
Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
If oDataObject.GetFormat(1) && 1=text
This.OLEDropHasData=1
Endif
ENDPROC

PROCEDURE unload
cancel

ENDDEFINE 

誌謝

狐友green

參考資料