How to set BackgroundColor on edit text using mycode and fix 1 error?
Afficher commentaires plus anciens
function [] = main ()
figure('name','CROSSWORD PUZZLE','MenuBar','none','Color',[.7,.78,1],'units','normalized','outerposition',[0 0 .5 .8]')
Title='CROSSWORD';
a=1;
for x=20:30:260
tagn=strcat('TBox',num2str(a));
uicontrol('Style','edit','position',[x, 530, 30, 30],'String',Title(a),'FontSize',20,'Tag',tagn)
a=a+1;
end
TitleB='PUZZLE';
a=1;
for x=80:30:230
tagn=strcat('TBox1',num2str(a));
uicontrol('Style','edit','position',[x, 500, 30, 30],'String',TitleB(a),'FontSize',20,'Tag',tagn)
a=a+1;
end
S.pb = uicontrol('Style','pushbutton','Position',[500 350 60 30],'String','PLAY');
set(S.pb,'callback',@game)
S.ob = uicontrol('Style','pushbutton','Position',[500 300 60 30],'String','OPTION');
set(S.ob,'callback',@set)
function [] = game(hObject, eventdata, handles)
set(hObject,'Visible','off');
[numeric,strings]=xlsread('puz.xlsx', 'sheet1', 'A1:N14');
a=1;
for x=20:30:620
for y=420:-30:30
Ebox(a)=uicontrol('Style','edit','position',[x y 30 30],'FontSize',20,'String',strings(a))
if string(a)==''
set(Ebox(a),'BackgroundColor','black')
end
a=a+1;
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Word games dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!