大佬教程收集整理的这篇文章主要介绍了用Silverlight自定义控件代替ActiveX安全密码输入框,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<UserControl x:Class="SilverX.SXpasswordBox" xmlns="http://scheR_38_11845@as.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://scheR_38_11845@as.microsoft.com/winfx/2006/xaml" xmlns:d="http://scheR_38_11845@as.microsoft.com/expression/blend/2008" xmlns:mc="http://scheR_38_11845@as.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="50" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" BACkground="White"> <passwordBox x:Name="_Value"/> </Grid> </UserControl>
[ScriptableMemberAttribute]//对脚本公开成员 public String GetValue() { //在这里可以添加相应的加密代码,此处直接返回输入框的值。 return this._Value.password; }
<UserControl xmlns="http://scheR_38_11845@as.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://scheR_38_11845@as.microsoft.com/winfx/2006/xaml" xmlns:d="http://scheR_38_11845@as.microsoft.com/expression/blend/2008" xmlns:mc="http://scheR_38_11845@as.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:SilverX" x:Class="SilverX.MainPage" mc:Ignorable="d" d:DesignHeight="50" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" BACkground="White"> <local:SXpasswordBox x:Name="pwdBox"/> </Grid> </UserControl>
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); this.Loaded += (obj,E) => { HtmlPage.RegisterScriptabLeobject("pwdBox",this.pwdBox); }; } }
<script type="text/javascript"> var control = null; function plugInLoaded(sender,args) { control = sender.getHost();//获取宿主 } function getValue() { try { this.Text1.value= control.Content.pwdBox.GetValue(); } catch (E) { alert(E); } } </script>
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400" height="27"> <param name="source" value="ClientBin/SilverX.xap"/> <param name="onError" value="onSilverlightError" /> <param name="BACkground" value="white" /> <param name="minRuntimeVersion" value="5.0.61118.0" /> <param name="autoUpgrade" value="true" /> <param name="onLoad" value="plugInLoaded"/> <!--这一行是新加的--> <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none"> <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="获取 Microsoft Silverlight" style="border-style:none"/> </a> </object>
<input id="Text1" type="text" /> <input id="Button1" type="button" value="Get" onclick="getValue();"/><!--点击按钮调用JS函数-->
以上是大佬教程为你收集整理的用Silverlight自定义控件代替ActiveX安全密码输入框全部内容,希望文章能够帮你解决用Silverlight自定义控件代替ActiveX安全密码输入框所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。