tailieunhanh - ASP.NET 4 Unleased - p 162
Việc kiểm soát trong Ví dụ 36,6 ám đằng sau một bóng thả bất cứ văn bản mà bạn chỉ định cho tài sản của văn bản điều khiển (xem hình 36,3). Các hiệu ứng bóng đổ được tạo ra với sự giúp đỡ của một Internet Explorer DropShadow lọc. | 1584 CHAPTER 36 Building Custom Controls The control in Listing renders a drop shadow behind whatever text you assign to the control s Text property see Figure . The drop shadow is created with the help of an Internet Explorer DropShadow filter. FIGURE Displaying a drop shadow with the DropShadow control. The Filter attribute is added to the div tag with a call to the AddStyleAttribute method. The AddStyleAttribute method works just like the AddAttribute method except that the AddStyleAttribute method adds a CSS attribute instead of an HTML attribute. WEB STANDARDS NOTE Filters are an Internet Explorer extension to the CSS standard. They don t work with Firefox or Opera. Firefox has its own extensions to CSS with its -moz style rules. Specifying the Containing WebControl Tag By default a WebControl renders an HTML span tag around its contents. You can specify a different tag by overriding the WebControl s TagKey property. For example the control in Listing renders its contents within an HTML div tag. From the Library of Wow eBook Overview of Custom Control Building 1585 LISTING using using namespace myControls public class Glow WebControl private string _Text public string Text get return _Text set _Text value protected override HtmlTextWriterTag TagKey get return protected override void AddAttributesToRender HtmlTextWriter writer glow Color ffd700 Strength 10 writer protected override void RenderContents HtmlTextWriter writer _Text public Glow 500px 36 From the Library of Wow eBook 1586 CHAPTER 36 Building Custom Controls The control in Listing displays a glowing effect around any text that you assign to its Text property. The control takes advantage of the Internet Explorer Glow filter to create the glow effect see Figure . In a real production .
đang nạp các trang xem trước