会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
翱翔.Net
释放.Net的力量
博客园
::
首页
::
新随笔
::
联系
::
订阅
::
管理
公告
Web自定义控件FlashLabel
Posted on
2005-02-28 08:59
Hover
阅读(
4222
) 评论(
8
)
收藏
举报
using
System;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.ComponentModel;
namespace
Hover.WebControls
{
/**/
///
<summary>
///
FlashLabel 的摘要说明。
///
Description:文字闪烁的Label控件
///
WebSite:IT动力营 Http://ITHero.NET
///
Author:翱翔.Net(Hover)
///
Email:zytp@163.com
///
MSN:Zytp@MSN.Com
///
Blog:Http://CnBlogs.Com/Hover
///
</summary>
[DefaultProperty(
"
Text
"
),
ToolboxData(
"
<{0}:FlashLabel runat=server ></{0}:FlashLabel>
"
)]
public
class
FlashLabel : System.Web.UI.WebControls.Label
{
private
int
flashSpeed
=
100
;
[Bindable(
true
),
Category(
"
Appearance
"
),
DefaultValue(
""
),
Description(
"
文字闪烁速度!
"
)]
public
int
FlashSpeed
{
get
{
return
flashSpeed;
}
set
{
flashSpeed
=
value;
}
}
/**/
///
<summary>
///
将此控件呈现给指定的输出参数。
///
</summary>
///
<param name="output">
要写出到的 HTML 编写器
</param>
protected
override
void
Render(HtmlTextWriter output)
{
string
s;
string
scriptString
=
"
<script language=JavaScript> \n
"
;
scriptString
+=
"
function glowit(which){ \n
"
;
scriptString
+=
"
if (document.all.glowtext.filters[0].strength==2) \n
"
;
scriptString
+=
"
document.all.glowtext.filters[0].strength=1 \n
"
;
scriptString
+=
"
else \n
"
;
scriptString
+=
"
document.all.glowtext.filters[0].strength=2 } \n
"
;
scriptString
+=
"
function startglowing(){ \n
"
;
scriptString
+=
"
var fp='
"
+
this
.FlashSpeed
+
"
'; \n
"
;
scriptString
+=
@"
setInterval(""glowit(0)"",fp)}
"
;
scriptString
+=
"
\n window.onload=startglowing \n
"
;
scriptString
+=
"
</script>
"
;
s
=
string
.Format(
@"
<div id=glowtext style=""FILTER: glow(color={0},strength=2); WIDTH: 5%"">{1}</div>
"
,
new
object
[]
{
this
.ForeColor.Name,
this
.Text}
);
output.Write(scriptString);
output.Write(s);
}
}
}
刷新页面
返回顶部
博客园
© 2004-2025
浙公网安备 33010602011771号
浙ICP备2021040463号-3