% Use "normalized" for X and Width. % Use "pixels" for Y and Height. setpos(h,'0.25nz 100px 0.5nz 300px');There are other nice features, such as incrementing by certain values:
% Increase the width by 200 pixels setpos(h,'# # +200px #');Or positioning objects relative to other objects:
setpos(figure, '# # 400px 300px'); u(1) = uicontrol('string', '(0,0) gcf'); setpos(u(1), '0 0 60px 40px') u(2) = uicontrol('string', '(0,0) gca'); setpos(u(2), '0 0 60px 40px', gca)This function will allow me to do precise positioning of UIs with fewer lines of code. Thanks Jerome! Next week, I will introduce a different tool that assists in the overal GUI design. Stay tuned for Part 3... Comments? Tell us what you think about when you are laying out your GUI components. Is it readability? Or is it the level of informational content? Written by Jiro Doke, Senior Applications Engineer, The MathWorks, Inc.
要发表评论，请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。