首页 技术 正文
技术 2022年11月14日
0 收藏 384 点赞 3,404 浏览 4634 个字

1.xaml

 <UserControl xmlns:SilverlightClient="clr-namespace:SilverlightClient"  x:Class="SilverlightClient.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:SlInpu="clr-namespace:Sl.Input;assembly=Sl.Input"
mc:Ignorable="d" d:DesignWidth="" d:DesignHeight="">
<Grid x:Name="LayoutRoot">
<StackPanel>
<!--导航栏-->
<StackPanel Orientation="Horizontal" Background="WhiteSmoke">
<Button x:Name="myHTML" Content="HTML内容" FontSize=""/>
<Button x:Name="myFlash" Content="Flash" FontSize=""/>
<Button x:Name="myPDF" Content="PDF文档" FontSize=""/>
</StackPanel>
<Grid Grid.Row="" x:Name="contentLayout2" Visibility="Visible">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border x:Name="borHtmlrb" HorizontalAlignment="Stretch" Grid.Row="" Grid.Column="" Background="Red">
<SilverlightClient:ControlHtmlHost x:Name="ccc"/>
</Border>
<Border Grid.Row="" Grid.Column="" Background="Blue">
<ScrollViewer Margin="0,5,5,5">
<Grid Grid.Row="" Grid.Column="" Margin="0,5,5,5">
<Grid.RowDefinitions>
<RowDefinition Height=""/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="">
<!--<TextBox Width="" Height=""/>-->
<!--<SlInpu:SLInput x:Name="mytxt" Width="" Height="" Foreground="Red" FontSize="" ></SlInpu:SLInput>-->
<SlInpu:SLInput x:Name="mytxt1" Width="" Height="" Foreground="Red" FontSize="" ></SlInpu:SLInput>
</StackPanel>
<StackPanel Grid.Row="" HorizontalAlignment="Center" Margin="0,15,0,5">
<TextBlock x:Name="txtTimeThree" FontSize="" FontFamily="SimSun" Text=""/>
<TextBlock x:Name="txtTimeFWThree" FontSize="" FontFamily="SimSun" Text=""/>
</StackPanel>
<Border Grid.Row="" Margin="">
<Button Content="dddd" Width="" Height=""/>
</Border>
<StackPanel Grid.Row="" HorizontalAlignment="Center" Margin="0,15,0,5">
<TextBlock x:Name="txtTimeSix" FontSize="" FontFamily="SimSun" Text=""/>
<TextBlock x:Name="txtTimeFWSix" FontSize="" FontFamily="SimSun" Text=""/>
</StackPanel>
<Border Grid.Row="" Margin="">
<Button Content="dddd" Width="" Height=""/>
</Border>
</Grid>
</ScrollViewer>
</Border>
<Border x:Name="borHtmlyb" Grid.Row="" Grid.Column="" Background="Red">
<SilverlightClient:ControlHtmlHost x:Name="aaa" />
</Border>
<Border x:Name="borHtmlxb" Grid.Row="" Grid.Column="" Background="Red">
<SilverlightClient:ControlHtmlHost x:Name="bbb" />
</Border>
</Grid>
</StackPanel> </Grid>
</UserControl>

2.xaml.cs

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Divelements.SilverlightTools; namespace SilverlightClient
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
//注册事件触发处理
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
this.myHTML.Click += new RoutedEventHandler(myHTML_Click);
this.myFlash.Click += new RoutedEventHandler(myFlash_Click);
this.myPDF.Click += new RoutedEventHandler(myPDF_Click);
} void MainPage_Loaded(object sender, RoutedEventArgs e)
{
//GetRichContent("http://cn.bing.com", UriKind.Absolute);
} void myPDF_Click(object sender, RoutedEventArgs e)
{
//GetRichContent("/test.pdf",UriKind.Relative);
//InitHtml();
//MessageBox.Show(mytxt.Text);
} void myFlash_Click(object sender, RoutedEventArgs e)
{
//GetRichContent("/clock.swf", UriKind.Relative);
} void myHTML_Click(object sender, RoutedEventArgs e)
{
GetRichContent(aaa, "/YB.HTM", UriKind.Relative);
GetRichContent(bbb, "/YB.HTM", UriKind.Relative);
GetRichContent(ccc, "/XB.HTM", UriKind.Relative);
}
private void InitHtml()
{
GetRichContent(borHtmlrb, "/DQ.HTM", UriKind.Relative);
GetRichContent(borHtmlyb, "/YB.HTM", UriKind.Relative);
GetRichContent(borHtmlxb, "/XB.HTM", UriKind.Relative);
}
private void GetRichContent(Border name, string uri, UriKind uk)
{
ControlHtmlHost chtml = new ControlHtmlHost();
HtmlHost hh = chtml.FindName("htmlHost") as HtmlHost;
hh.SourceUri = new Uri(uri, uk);
name.Child = chtml;
}
//获取Rich Content
void GetRichContent(ControlHtmlHost chtml, string uri, UriKind uk)
{
HtmlHost hh = chtml.FindName("htmlHost") as HtmlHost;
hh.SourceUri = new Uri(uri, uk); }
}
}

3.添加引用Divelements.SilverlightTools.dll
4.设置启动页面  <param name=”windowless” value=”true” />

以上是设置silverlight嵌套html文件

5.添加Sl.Input.dll引用

6.在xaml里添加<SlInpu:SLInput x:Name=”mytxt1″ Width=”220″ Height=”150″ Foreground=”Red” FontSize=”18″ ></SlInpu:SLInput>

7.在百度网盘里搜索slInput.rar

8.有需要类库的朋友,请给我留言。。。。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,497
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,910
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,744
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,498
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,135
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,300