Silverlight入门教程(17)

逝伤 分享 2021-04-05 下载文档

资料,教程,编程,文集

00" Stroke="Black" StrokeThickness="10" Fill="Lime" />'; ellipse = plugin.content.createFromXaml(xamlFragment2); ellipse.fill = createLinearGradientBrush(plugin); sender.children.add(textBlock); sender.children.add(ellipse); } function createLinearGradientBrush(plugin) { var xamlFragment = '
'; xamlFragment += xamlFragment += xamlFragment += '<GradientStop Color="Yellow" Offset="0.0" />'; '<GradientStop Color="Orange" Offset="0.5" />'; '<GradientStop Color="Red" Offset="1.0" />';
xamlFragment += ''; return plugin.content.createFromXaml(xamlFragment); }
6. 访问和修改 Silverlight 元素以及属性 I. 页面代码(Default.aspx)
II.Xaml 文件代码
<Canvas Name="parentCanvas" xmlns="/client/2007"
xmlns:x="/winfx/2006/xaml" Loaded="onLoaded" > <TextBlock Name="TextBlock1" Foreground="Black" Cursor="Hand" /> <TextBlock Name="TextBlock2" Foreground="Black" Cursor="Hand" Canvas.Top="20" /> <TextBlock Name="TextBlock3" Foreground="Black" Cursor="Hand" Canvas.Top="40" /> </Canvas>
III.页面对应的 JS 文件代码(Default.aspx.js)
function createSilverlight() { Silverlight.createObjectEx({ source: "Page.xaml", parentElement: document.getElementById("SilverlightControlHost"), id: "SilverlightControl", properties: { width: "350", height: "350", version: "1.0", background: "white", isWindowless: "true", enableHtmlAccess: "true" }, events: {} }); } function onLoaded(sender, eventArgs) { //findName Method sender.findName("TextBlock1").text = "King1"; //getItem Method sender.children.getItem(1).text = "King2"; //getValue 和setValue 方法 var textBlock3 = sender.findName("TextBlock3"); textBlock3.text = "King3"; var text = textBlock3.getValue("text"); textBlock3.setValue("text", text); //Extend Property
textBlock3["Canvas.Top"] = 40; //自己修改一下该值 }
7. Silverlight 中的字体使用 I. 页面代码(Default.aspx)
II.Xaml 文件代码
<Canvas Name="parentCanvas" xmlns="/client/2007" xmlns:x="/winfx/2006/xaml" Loaded="onLoaded" > <TextBlock Text="Font Attributes" FontFamily="Verdana" FontSize="36" FontStretch="UltraExpanded" FontStyle="Italic" FontWeight="ExtraBlack" />
<TextBlock Canvas.Top="60" FontFamily="Arial" Width="400" Text="Sample text formatting runs">
<Run Foreground="Maroon" FontFamily="Courier New" FontSize="24">Courier New 24</Run>
<Run Foreground="Teal" FontFamily="Times New Roman" FontSize="18" FontStyle="Italic">Times New Roman Italic 18</Run>
<Run Foreground="SteelBlue" FontFamily="Verdana" FontSize="14" FontWeight="Bold">Verdana Bold 14</Run> </TextBlock> <TextBlock Canvas.Top="150" FontFamily="Arial" FontSize="32" FontWeight="Bold" Foreground="Navy"> Navy <Run Text="DodgerBlue " Foreground="DodgerBlue"/> <Run Text="LightSteelBlue &
quot; Foreground="LightSteelBlue"/> </TextBlock>
<TextBlock Canvas.Top="200" FontFamily="Verdana" Fon


Silverlight入门教程(17).doc 将本文的Word文档下载到电脑

下一篇:镇江市2013届第一学期期中调研测试高三语文参考答案及评分标准

相关推荐
相关阅读
本类排行
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 7

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xxxxxx QQ:xxxxxx