让网页中的Silverlight背景也透明

Posted on August 31, 2007 by Fdream

Silverlight的背景也是可以透明的,改改JS代码就好了~

打开TestPage.html.js(默认的文件名),修改createSilverlight()函数,在properties大括号中增加两行:

isWindowless: “true”,
background: “#00ffffff”,

由于Sivlerlight中的颜色采用ARGB模式,即Alpha、Red、Green、Blue各用两位十六进制数来表示,所以只要把代表Alpha的那两位设置为00就行了,其他的随便了,反正透明了也看不到。

如果是把这两行放到原来代码的最后面(properties大括号以内),要记得把原来的最后一行代码末尾加上一个半角的逗号,而现在的最后一行就不要那个逗号了,即这个样子的:

properties: {
width: “100%”,
height: “100%”,
version: “1.1″,
enableHtmlAccess: “true”,
isWindowless: “true”,
background: “#00ffffff”
},

就这么简单!

分享 |
Categories:
Silverlight/C#
Tags:
,
Comments:
Leave a comment
Views:
14,380 Views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>