该控件的效果就是可以使相应的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