MainPage.xaml

  <Grid x:Name="LayoutRoot" Background="White">
<Border BorderThickness="" BorderBrush="Black" />
<Grid ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height=""/>
<RowDefinition Height=""/>
<RowDefinition Height=""/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=""/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="二维码" Grid.Column="" Grid.Row="" TextAlignment="Center" Margin="10,50" />
<Image x:Name="imgCode" Grid.Column="" Grid.Row="" Margin=""/>
<TextBlock Text="图片大小" Grid.Column="" Grid.Row="" Margin="" TextAlignment="Center" />
<ComboBox x:Name="cmbSize" Grid.Column="" Grid.Row="" Width="" Height="" HorizontalAlignment="Right" Margin="0,10,100,10">
<ComboBoxItem Content="" IsSelected="True" />
<ComboBoxItem Content="" />
</ComboBox>
<TextBlock Text="二维码内容" Grid.Column="" Grid.Row="" TextAlignment="Center" Margin=""/>
<TextBox x:Name="txtContent" Height="" Margin="" Grid.Column="" Grid.Row="" />
<Button x:Name="btnAdd" Content="生成" Width="" Grid.Row="" Grid.Column="" Click="btnAdd_Click" Margin=""/>
</Grid>
</Grid>

MainPage.xaml.cs

  public partial class MainPage : UserControl
{
StringBuilder sb = null;
Uri uri = null;
public MainPage()
{
InitializeComponent();
sb = new StringBuilder();
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
sb.Append("http://chart.apis.google.com/chart?cht=qr&chs=");
sb.Append(((ComboBoxItem)cmbSize.SelectedItem).Content.ToString());
sb.Append("x");
sb.Append(((ComboBoxItem)cmbSize.SelectedItem).Content.ToString());
sb.Append("&chl=");
sb.Append(txtContent.Text);
uri = new Uri(sb.ToString());
imgCode.Source = new BitmapImage(uri);
sb.Clear();
}
}

silverlight 生成二维码的更多相关文章

  1. C#利用QrCode.Net生成二维码(Qr码)

    在网上很多应用都是用二维码来分享网址或者其它的信息.尤其在移动领域,二维码更是有很大的应用场景.因为项目的需要,需要在网站中增加一个生成二维码分析网址的功能,在谷歌大幅度抽筋的情况下无奈使用百度.百度 ...

  2. C#利用QrCode.Net生成二维码(Qr码

    http://www.cnblogs.com/Soar1991/archive/2012/03/30/2426115.html 现在网上很多应用都是用二维码来分享网址或者其它的信息.尤其在移动领域,二 ...

  3. Javascript生成二维码(QR)

    网络上已经有非常多的二维码编码和解码工具和代码,很多都是服务器端的,也就是说需要一台服务器才能提供二维码的生成.本着对服务器性能的考虑,这种小事情都让服务器去做,感觉对不住服务器,尤其是对于大流量的网 ...

  4. 使用jquery.qrcode生成二维码(转)

    jQuery 的 qrcode 插件就可以在浏览器端生成二维码图片. 这个插件的使用非常简单: 1.首先在页面中加入jquery库文件和qrcode插件. <script type=" ...

  5. iOS 生成二维码

    首先先下载生成二维码的支持文件 libqrencode 添加依赖库 CoreGraphics.framework. QuartzCore.framework.AVFoundation.framewor ...

  6. QR code 扩展生成二维码

    include './phpqrcode/phpqrcode.php';  //引入QR库 QRcode::png("leo", 'qrcode.png', 'L', 10);  ...

  7. Python 创建本地服务器环境生成二维码

    一. 需求 公司要做一个H5手机端适配页面,因技术问题所以H5是外包的,每次前端给我们源码,我们把源码传到服务器让其他人访问看是否存在bug,这个不是很麻烦吗?有人说,可以让前端在他们的服务器上先托管 ...

  8. C#通过第三方组件生成二维码(QR Code)和条形码(Bar Code)

    用C#如何生成二维码,我们可以通过现有的第三方dll直接来实现,下面列出几种不同的生成方法: 1):通过QrCodeNet(Gma.QrCodeNet.Encoding.dll)来实现 1.1):首先 ...

  9. 使用Spire.Barcode程序库生成二维码

    使用Spire.Barcode程序库生成二维码 某天浏览网页发现了一个二维码的程序库.它的描述说他可以扫描二维码图像.我很感兴趣,想试试他是不是会有用.所以我就用了些方法扫描二维码图像来测试一下.结果 ...

随机推荐

  1. IOS UIwebView 加载网络图片 使用相对地址

    方法一: 在html文件内直接使用file:///user//xx//image.png的绝对路径 注:这样可以显示图片,但是如果在程序目录修改,图片就不能显示 方法二: 在html使用占位符,如:在 ...

  2. Java基础知识强化之IO流笔记78:NIO之 FileChannel

    Java NIO中的FileChannel是一个连接到文件的通道.可以通过文件通道读写文件. FileChannel无法设置为非阻塞模式,它总是运行在阻塞模式下. 1. 打开FileChannel 在 ...

  3. 测试 IE 浏览器兼容性 VirtualBox + modern.ie

    VirtualBox 是开源的虚拟机软件,常用的虚拟机软件还有 VMware / Hyper-V / Paralles Desktop . modern.ie 是微软官方提供的用于测试网页在各版本 I ...

  4. remove all .git files and directories use one command

    find . -type d -name ".git" | xargs rm -rf

  5. setcookie 之 我见

    $default_currency=get_default_currency(); $_COOKIE['currency'] = $default_currency['currency']; $_CO ...

  6. sql语句大全~·留着有用

    一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备 ...

  7. cordova发送邮件插件:ngcordova plugin-Email Composer

    这是ngcordova里边的一个发送邮件的插件,具体的使用方法为: (参考文档:http://ngcordova.com/docs/plugins/emailComposer/) 1.首先下载插件: ...

  8. codeforces 675E E. Trains and Statistic(线段树+dp)

    题目链接: E. Trains and Statistic time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  9. winform分页管理

    注意:其中可能用到部分自定义的扩展方法,在使用中需自己修改一下 /// <summary> /// 分页管理 /// </summary> public class Pagin ...

  10. 结合setTimeout和clearTimeout,实现“返回顶部”的功能

    结合setTimeout和clearTimeout,当页面停止滚动时,“返回顶部”按钮淡隐淡出.点击“返回顶部”页面以动画形式返回顶部.完美兼容ie6-11,firefox,chrome等. html ...