problem with positioning in GUI

3 次查看(过去 30 天)
i am developing a gui with UI controls, when I am defining the size the of the figure to appear, It displays the whole screen, all the other uicontrols are placed properly.
I tried out just just the command line with f=.... in seperate window changing various values in 'pos', but it shows the full screen. any suggestions would be helpful.
function fnt()
pos = [10,10,490,650];
col= [0.831 0.816 0.784];
f = figure('name','Project','numbertitle','off',...
'menubar','none','units','normalized',...
'color',col,'position', pos)
movegui(f,'center')
col=get(f,'color');
%Name plate
uicontrol('style','text','string','Selected Files',...
'position',[35,600,80,18],'backgroundcolor', col);
%creates a list box
uicontrol('style','listbox','position',[30,500,270,100],...
'foregroundcolor', [0 0 0],'backgroundcolor', [1 1 1]);
end

采纳的回答

Davide Ferraro
Davide Ferraro 2011-2-4
If you are working with normalized units you should use position values between 0 and 1 to set the position.
The following code creates a figure that is not taking the whole screen:
f = figure('name','Project','numbertitle','off',...
'menubar','none','units','normalized',...
'color',col,'position', [0.1 0.1 0.3 0.5])
I would suggest you to keep using normalized units also for all UICONTROL objects.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by