AJAX Control Toolkit——DropShadow(阴影和圆角框)

本文深入探讨了ASP.NET Panel控件中的DropShadow效果,解释了其工作原理,并提供了CSS3实现类似效果的方法。同时,文章强调了正确使用CSS属性的重要性,以避免意外的布局问题。

该控件的效果就是可以使相应的Panel产生阴影和圆角框的效果,要说的是该控件在CSS3来临之际并不存在多大的意义了,因为在CSS3中同样可以实现而且更加理想的效果。

但是要说明的是不要为目标Panel添加过多的CSS属性,不然会出现预料之外的效果,如果你想设置内容的内边距(padding),建议用在Panel里面嵌套div,在为期添加相应的CSS。

 1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head runat="server">
6 <title>DropShadow</title>
7 <style type="text/css">
8 .content
9 {
10 padding: 10px;
11 font-family:微软雅黑;
12 font-size:16px;
13 }
14 .para
15 {
16 font-weight:bold;
17 font-size:14px;
18
19 }
20 li{ padding:5px; list-style-type:none;}
21 </style>
22 </head>
23 <body>
24 <form id="form1" runat="server">
25 <asp:ScriptManager ID="ScriptManager1" runat="server" />
26 <br />
27 <br />
28 <div>
29 <asp:Panel ID="Panel1" runat="server" BackColor="#C0C0FF" Height="450px" Width="960px">
30 <div class="content">
31 <p>
32 DropShadow is an extender that applies a drop shadow to an ASP.NET Panel control.
33 The extender allows you to specify how wide the shadow is, how opaque it is, and
34 whether the shadow should have rounded corners. For pages that let the user move
35 or resize the panel, the DropShadow extender has a mode that will resize and reposition
36 the shadow to match the target panel at run time.</p>
37
38 <li>TargetControlID</li>- The ID of the control to extend.
39 <li> Width </li> - The width, in pixels,
40 of the drop shadow. The default is 5.
41 <li>Opacity</li>
42 - The opacity of the drop shadow,
43 from 0 (fully transparent) to 1.0 (fully opaque). The default is .5.
44 <li>TrackPosition</li>- A Boolean value that specifies whether the dropshadow should track the position
45 of the panel it is attached to. Set this property to true if the panel is absolutely
46 positioned or if it might move at run time. The default is false.
47 <li>Rounded</li> - A Boolean
48 value that specifies whether the corners of the target and drop shadow should be
49 rounded
50 </div>
51 </asp:Panel>
52 <ajaxToolkit:DropShadowExtender ID="DropShadowExtender1" runat="server" TargetControlID="Panel1"
53 Opacity=".7" Rounded="true" Radius="12">
54 </ajaxToolkit:DropShadowExtender>
55 </div>
56 </form>
57 </body>
58 </html>

更多参数和方法请参见@http://www.asp.net/ajaxlibrary/act_DropShadow.ashx

转载于:https://www.cnblogs.com/January/archive/2011/08/03/2126025.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值