标签:osc 方法 script The drag load stop hid tar
xml中代码:
<Frame name="MyFrame" frameStrata="DIALOG" toplevel="true" enableMouse="true" movable="true" hidden="true" parent="UIParent" enableKeyboard="true" >
<Size>
<AbsDimension x="500" y="380"/>
</Size>
<Scripts>
<OnLoad>this:RegisterForDrag("LeftButton");</OnLoad>
<OnDragStart>this:StartMoving();</OnDragStart>
<OnDragStop>this:StopMovingOrSizing();</OnDragStop>
<OnMouseDown>
this:SetClampedToScreen(true)
</OnMouseDown>
</Scripts>
……
</Frame>
lua中的代码:
MyFrame:SetMovable(true)
MyFrame:RegisterForDrag("LeftButton")
MyFrame:SetScript("OnDragStart", function()
if arg1 == "LeftButton" then
MyFrame:StartMoving()
end
end)
MyFrame:SetScript("OnDragStop", function()
MyFrame:StopMovingOrSizing()
end)
MyFrame:SetScript("OnMouseDown", function()
MyFrame:SetClampedToScreen(true)
end)
标签:osc 方法 script The drag load stop hid tar
原文地址:https://www.cnblogs.com/hsoftk/p/12236420.html