Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2008-04-26
年龄: 39
帖子: 1
声望力: 0 ![]() |
![]()
我在做一个登录对话框,
密码输入时,我想他是立刻显示为"*"形式: 请问怎样可以实现? |
![]() |
![]() |
![]() |
#2 |
初级会员
注册日期: 2008-03-28
年龄: 42
帖子: 12
声望力: 18 ![]() |
![]()
同求啊,谢谢各位大侠
|
![]() |
![]() |
![]() |
#3 |
初级会员
注册日期: 2008-05-30
年龄: 44
帖子: 4
声望力: 0 ![]() |
![]()
查键盘检测的函数,通过键盘检测获得口令与已知口令比对,设置显示的字符串为********。
|
![]() |
![]() |
![]() |
#4 |
普通会员
注册日期: 2007-08-07
帖子: 64
声望力: 20 ![]() |
![]()
function mima
OldHandle = findobj( 'Type', 'figure', 'Tag', 'mimadenglu' ) ; if ishandle( OldHandle ) close( OldHandle ) ; end fig = figure ; scnsize=get(0,'screensize'); set(fig,'units','normalized','position',[0.3 0.2 0.4 0.6],... 'menubar','none','name','密码登陆窗口',... 'numbertitle','off','color',[0.925 0.914 0.847],'tag','mimadenglu'); font_size1=round(20*sqrt(scnsize(3)*scnsize(4)/(1024*768))); font_size2=round(14*sqrt(scnsize(3)*scnsize(4)/(1024*768))); uicontrol(fig,'style','text','units','normalized','pos',[0.1 0.63 0.8 0.15],'string','欢迎使用本系统',... 'fontsize',font_size1,'fontweight','bold','fontunits','normalized','bac',[0.925 0.914 0.847]) panel1=uipanel(fig,'units','normalized','pos',[0.15 0.3 0.7 0.15],'bac',[0.925 0.914 0.847]); uicontrol(panel1,'style','edit','units','normalized','pos',[0.2 0.2 0.6 0.6],... 'string','','tag','edit1','backgroundcolor',[1 1 1],'string','请输入密码',... 'fontsize',font_size2,'fontunits','normalized','KeyPressFcn',... ['currKey = get(gcf,''Currentkey'');',... 'currChar = get(gcf,''Currentcharacter'');',... 'switch currKey;',... 'case {''backspace'',''delete''};',... 'Char = [];',... 'set(gcbo,''String'','''');',... 'drawnow;',... 'case ''return'';',... 'passChar = get(gcbo,''UserData'');',... 'if strcmp(passChar,''654321'');',... 'msgbox(''恭喜你记住了密码!!!'');',... 'else;',... 'msgbox(''密码输入错误!!!'');',... 'end;',... 'return;',... 'otherwise;',... 'oldChar = get(gcbo,''UserData'');',... 'Char = [oldChar,currChar];',... 'set(gcbo,''string'',char(''*''*ones(1,length(Char))));',... 'end;',... 'set(gcbo,''UserData'',Char);']) |
![]() |
![]() |