如何让我们做的silverlight 在HTML上层透明显示,其实非常简单
当我们把一个默认的silverlight项目嵌入在Html中的代码.默认的silverlight背景为白色.代码如下所示
<
object
data
="data:application/x-silverlight,"
type
="application/x-silverlight-2-b2"
width
="600"
height
="600"
>
< param name ="source" value ="ClientBin/MakeSilverlightControlTransparent.xap" />
< param name ="onerror" value ="onSilverlightError" />
< param name ="background" value ="white" />
< a href ="http://go.microsoft.com/fwlink/?LinkID=115261" style ="text-decoration: none;" >
< img src ="http://go.microsoft.com/fwlink/?LinkId=108181" alt ="Get Microsoft Silverlight" style ="border-style: none" />
</ a >
</ object >
< param name ="source" value ="ClientBin/MakeSilverlightControlTransparent.xap" />
< param name ="onerror" value ="onSilverlightError" />
< param name ="background" value ="white" />
< a href ="http://go.microsoft.com/fwlink/?LinkID=115261" style ="text-decoration: none;" >
< img src ="http://go.microsoft.com/fwlink/?LinkId=108181" alt ="Get Microsoft Silverlight" style ="border-style: none" />
</ a >
</ object >
我们如何实现透明显示关键在HTML Page 中的 background 和 windowless .
在HTML页面silverlight对象中添加 如下Code
<
param
name
="background"
value
="Transparent"
/>
< param name ="windowless" value ="true" />
< param name ="windowless" value ="true" />
Example:
<
object
data
="data:application/x-silverlight,"
type
="application/x-silverlight-2-b2"
width
="600"
height
="600"
>
< param name ="source" value ="ClientBin/MakeSilverlightControlTransparent.xap" />
< param name ="onerror" value ="onSilverlightError" />
< param name ="background" value ="Transparent" />
< param name ="windowless" value ="true" />
< a href ="http://go.microsoft.com/fwlink/?LinkID=115261" style ="text-decoration: none;" >
< img src ="http://go.microsoft.com/fwlink/?LinkId=108181" alt ="Get Microsoft Silverlight" style ="border-style: none" />
</ a >
</ object >
< param name ="source" value ="ClientBin/MakeSilverlightControlTransparent.xap" />
< param name ="onerror" value ="onSilverlightError" />
< param name ="background" value ="Transparent" />
< param name ="windowless" value ="true" />
< a href ="http://go.microsoft.com/fwlink/?LinkID=115261" style ="text-decoration: none;" >
< img src ="http://go.microsoft.com/fwlink/?LinkId=108181" alt ="Get Microsoft Silverlight" style ="border-style: none" />
</ a >
</ object >
快去测试一下吧