Search This Blog

Wednesday, October 27, 2010

Code for Shadow in text C#

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="custom" Namespace="mycontrols" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
   
<div>
<custom:DropShadow id="Dropshadow1"
Text="an application with bug is like Soup with a fly."
Font-Size="30px"
runat="Server" />
</div>

    </form>
</body>
</html>


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for DropShadow
/// </summary>
namespace mycontrols
{
    public class DropShadow:WebControl
    {
        private string _Text;
        public string Text
        {
            get { return _Text; }
            set { _Text = value; }
        }
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.Filter, "dropshadow(color=red,offX=3,offY=3);width:300px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write(_Text);
            writer.RenderEndTag();
        }


        public DropShadow()
        {
            //
            // TODO: Add constructor logic here
            //
        }
    }
}

2 comments :

manju chandra said...

Nice and interesting.

Anonymous said...

good code for showing text in diffrent way......