2012-10-27 52 views

回答

3

您應該使用axes圖形控制:

f= figure() 
a = axes('Position',[0 0 1 1],'Units','Normalized'); 
imshow('peppers.png','Parent',a); 

你可以把任何你想要的軸上面:

uicontrol('Style','text','Units','Normalized','Position',[0.1 0.1 0.3 0.6],'String','Example'); 

你可以做到這一點的指南爲好,簡單的拉伸一個軸在整個數字手動。

enter image description here

enter image description here

3

有一個這樣做的另一種方式。 轉到 function untitled_OpeningFcn(hObject, eventdata, handles, varargin)功能和右handles.output = hObject; guidata(hObject, handles);之間寫下下面的代碼

% create an axes that spans the whole gui
ah = axes('unit', 'normalized', 'position', [0 0 1 1]);
% import the background image and show it on the axes
bg = imread('your_image.jpg'); imagesc(bg);
% prevent plotting over the background and turn the axis off
set(ah,'handlevisibility','off','visible','off')
% making sure the background is behind all the other uicontrols uistack(ah, 'bottom');

Before
AfteG