How do I control the size of a checkbox in a programmatic GUI?
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a programmatic GUI and I'm trying to change the size of my checkboxes, but I can't get it to change. I've tried changing fontsize, position height, etc, but haven't figured out the right combination. The stubborn checkboxes remain the same size regardless. Here is my code to create the checkboxes.
hf = figure;
pos = [0, 0.9, 0.2, 0.04];
PlotStr = {'A','B','C','D'};
N = length(PlotStr);
NextRow = 0.064;
dx = 0.3;
TextPos = pos + [0 0 0 0];
CheckPos = pos + [0.3 0 0 0];
for inx = 1:N
textpos = TextPos - inx*[0 NextRow 0 0];
Check1Pos = CheckPos - inx*[0 NextRow 0 0];
PlotText(inx) = uicontrol(hf,'Style','text','String',PlotStr{inx},'Units','normalized','Position',textpos);
Checkbox(inx) = uicontrol(hf,'Style','checkbox','Units','normalized','Position',Check1Pos);
end
0 commentaires
Réponses (1)
Jan
le 16 Mar 2017
Modifié(e) : Jan
le 16 Mar 2017
The box itself does not change its size, because this size is controlled by the operating system. The size concerns the area occupied by teh combination of teh box and teh text. See:
figure;
uicontrol('Style', 'checkbox', 'String', 'Box 1', ...
'BackgroundColor', [1,0.3,0.3], ...
'Position', [10, 10, 100, 20]);
uicontrol('Style', 'checkbox', 'String', 'Box 2', ...
'BackgroundColor', [1,0.3,0.3], ...
'Position', [10, 50, 200, 60]);
0 commentaires
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!