存档
silverligth 页面现实滚动条的设置:
给用户控件内容加上scrollviewr,控件中就有滚动条了。
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
</ScrollViewer>
SilverLight应用程序开发,做用户登陆的时候都会涉及到验证码,在silverlight中验证码可以通过Service远程调用产生验证码,也可以直接在silverlight客户端中进行验证码生成,比如这样的界面:
上图中的验证码是通过silverlight中生成的:
1、首先创建一个IndentifyCodeClass.cs这样的类,这个类就是silverlight客户端验证码的核心类,
2、调用IndentifyCodeClass.cs类,
IndentifyCodeClass inc = new IndentifyCodeClass();
string _InitCheckCodeString = "";//存放生成的验证码,字符串的形式
_InitCheckCodeString = inc.CreateIndentifyCode(6);
inc.CreatImage(_InitCheckCodeString, CheckCodeImg, 120, 30);//CheckCodeImg是一个Image控件名
3、怎么验证用户输入的验证码是否正确?
//获取用户输入的验证码,比如变量为txtCheckCode.
if(txtCheckCode.ToLower()==_InitCheckCodeString.ToLower())
{
MessageBox.Show("验证码输入正确");
}
else
{
MessageBox.Show("验证码有误..");
}
附IndentifyCodeClass.cs下载
SilverLight中的AutoCompleteBox表示一个控件,该控件提供一个文本框(用于放置用户输入)和一个下拉项(根据文本框中的输入包含可能的匹配项)。例如这样:
在文本框中输入单词,该控件可以找到符合匹配规则的项填充文本框,这里介绍ItemFilter、TextFilter属性的使用方法
ItemFilter的使用方法
<navigation:Page x:Class="RIA.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
[...]
最新评论