jackyrong

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

有了atlas的话,做一些随意拖拉的效果就十分容易了。在vs.net 2005下,装了atlas的话,有很多控件
可以实现之,下面小结之

1、使用<atlas:DragOverlayProperties> 控件,比如
 <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
        <atlas:DragOverlayExtender ID="DragOverlayExtender1" runat="server">
            <atlas:DragOverlayProperties TargetControlID="Panel1" Enabled="true" ProfileProperty="Panel1Loc" />
                  </atlas:DragOverlayExtender>
        <atlas:ProfileScriptService ID="ProfileScriptService1" runat="server" AutoSave="true" />
        <div>
            <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Panel ID="Panel1" runat="server" BorderStyle="Solid" Height="198px" Width="194px">

                  //在这里写你要写的东西,比如一张图片
</asp:Panel>
                </ContentTemplate>
            </atlas:UpdatePanel>
而如果为了要记住每次拖拉后的位置,还要在web.config里设置,如
<system.web>
    <profile>
      <properties>
        <add name="Panel1Loc" type="System.String" />
      </properties>
    </profile>


<profileService enabled="true"
                    setProperties="Panel1Loc"
                    getProperties="Panel1Loc"
/>
这样设置好profile的服务,能够读和写这个位置的属性panel1loc,然后如上文说的那样设置:
 <atlas:DragOverlayExtender ID="DragOverlayExtender1" runat="server">
            <atlas:DragOverlayProperties TargetControlID="Panel1" Enabled="true" ProfileProperty="Panel1Loc" />
                  </atlas:DragOverlayExtender>
        <atlas:ProfileScriptService ID="ProfileScriptService1" runat="server" AutoSave="true" />
其中targetControlID指明了对panel1进行拖拉,要记住位置的属性是profileproperty来指定的,而
对profileScriptService设置autosave为true,则记住每次拖拉后的位置。


2、也可以使用atlas tookit中的DragPanelExtender控件,
比如
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server">
            <cc1:DragPanelProperties DragHandleID="Panel2" TargetControlID="Panel1" />
        </cc1:DragPanelExtender>

其中可以设置一个拖拉的区域,比如panel2,放一个提示性的文字,然后要被跟着一起拖拉的
区域设置为panel1,再分别用draghandelid,targetcontrolid来设置之。但用dragpanelExtender的话,不会每次
记住拖拉后的位置

posted on 2006-09-28 15:09  jackyrong的世界  阅读(896)  评论(0编辑  收藏  举报