系统登录框问题
做系统的登录框:想把edit中的输入数据变为*,希望大家帮忙一下 function mimaOldHandle = findobj( 'Type', 'figure', 'Tag', 'mimadenglu' ) ;
if ishandle( OldHandle )
close( OldHandle ) ;
end
fig = figure ;
set(fig,'units','normalized','position',,...
'menubar','none','name','密码登陆窗口',...
'numbertitle','off','color',,'tag','mimadenglu');
scnsize=get(0,'screensize');
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',,'string','欢迎使用本系统',...
'fontsize',font_size1,'fontweight','bold','fontunits','normalized','bac',)
panel1=uipanel(fig,'units','normalized','pos',,'bac',);
uicontrol(panel1,'style','edit','units','normalized','pos',,...
'string','','tag','edit1','backgroundcolor',,'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 = ;',...
'set(gcbo,''string'',char(''*''*ones(1,length(Char))));',...
'end;',...
'set(gcbo,''UserData'',Char);'])
回复 2楼 的帖子
找了半天了,谢谢了,我会好好学习一下!
页:
[1]