扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:朱先忠编译 来源:天极软件 2007年11月6日
关键字: Windows
Sys.UI.IDragSource = function() { this.get_dataType = Function.abstractMethod; this.get_data = Function.abstractMethod; this.get_dragMode = Function.abstractMethod; this.onDragStart = Function.abstractMethod; this.onDrag = Function.abstractMethod; this.onDragEnd = Function.abstractMethod; } Sys.UI.IDragSource.registerInterface('Sys.UI.IDragSource'); Sys.UI.IDropTarget = function() { this.get_dropTargetElement = Function.abstractMethod; this.canDrop = Function.abstractMethod; this.drop = Function.abstractMethod; this.onDragEnterTarget = Function.abstractMethod; this.onDragLeaveTarget = Function.abstractMethod; this.onDragInTarget = Function.abstractMethod; } Sys.UI.IDropTarget.registerInterface('Sys.UI.IDropTarget'); |
Type.registerNamespace('Custom.UI'); Custom.UI.DropZoneBehavior = function() { Custom.UI.DropZoneBehavior.initializeBase(this); this.initialize = function() { Custom.UI.DropZoneBehavior.callBaseMethod(this, 'initialize'); //把我们自己注册为一个拖放目标. Sys.UI.DragDropManager.registerDropTarget(this); } this.dispose = function() { Custom.UI.DropZoneBehavior.callBaseMethod(this, 'dispose'); } this.getDescriptor = function() { var td = Custom.UI.DropZoneBehavior.callBaseMethod(this, 'getDescriptor'); return td; } //IDropTarget成员. this.get_dropTargetElement = function() { return this.control.element; } this.drop = function(dragMode, type, data) { alert('dropped'); } this.canDrop = function(dragMode, dataType) { return true; } this.onDragEnterTarget = function(dragMode, type, data) {} this.onDragLeaveTarget = function(dragMode, type, data) {} this.onDragInTarget = function(dragMode, type, data) {} } Custom.UI.DropZoneBehavior.registerClass('Custom.UI.DropZoneBehavior', Sys.UI.Behavior, Sys.UI.IDragSource, Sys.UI.IDropTarget, Sys.IDisposable); Sys.TypeDescriptor.addType('script', 'DropZoneBehavior', Custom.UI.DropZoneBehavior); |
<atlas:ScriptManager ID="ScriptManager1" runat="server"> <Scripts> <atlas:ScriptReference ScriptName="AtlasUIDragDrop" /> <atlas:ScriptReference Path="scriptLibrary/DropZoneBehavior.js" /> </Scripts> </atlas:ScriptManager> |
<div style="background-color:Red;height:200px;width:200px;"> <div id="draggableDiv" style="height:100px;width:100px;background-color:Blue;"> <div id="handleBar" style="height:20px;width:auto;background-color:Green;"> </div> </div> </div> <div id="dropZone" style="background-color:cornflowerblue;height:200px;width:200px;"> Drop Zone </div> |
<script type="text/xml-script"> <page xmlns:script="http://schemas.microsoft.com/xml-script/2005"> <components> <control id="dropZone"> <behaviors> <DropZoneBehavior/> </behaviors> </control> <control id="draggableDiv"> <behaviors> <floatingBehavior handle="handleBar"/> </behaviors> </control> </components> </page> </script> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者