how ot code gui scrollbar ?
조회 수: 4 (최근 30일)
이전 댓글 표시
i have a gui in which i m showing some images but there are alot of images in figure so i want to use scrollbar..how can i code this??
댓글 수: 0
답변 (2개)
Anand
2014년 2월 16일
댓글 수: 2
Image Analyst
2014년 2월 17일
편집: Image Analyst
2014년 2월 17일
The word uicontrol is in blue, and the cursor turns into a hand when over it, which means it's a link.
Image Analyst
2014년 2월 16일
I'd use the scrollbar built in to a listbox. A listbox is so much more user friendly than a scroll bar because you can see the name and pick the image directly from the list. You can load a listbox like this:
%=====================================================================
% Load up the listbox with image files in folder handles.ImageFolder
function handles=LoadImageList(handles)
ListOfImageNames = {};
folder = handles.ImageFolder;
if ~isempty(handles.ImageFolder)
if exist(folder,'dir') == false
msgboxw(['Folder ' folder ' does not exist.']);
return;
end
else
msgboxw('No folder specified as input for function LoadImageList.');
return;
end
% If it gets to here, the folder is good.
ImageFiles = dir([handles.ImageFolder '/*.*']);
for Index = 1:length(ImageFiles)
baseFileName = ImageFiles(Index).name;
[folder, name, extension] = fileparts(baseFileName);
extension = upper(extension);
switch lower(extension)
case {'.png', '.bmp', '.jpg', '.tif', '.avi'}
% Allow only PNG, TIF, JPG, or BMP images
ListOfImageNames = [ListOfImageNames baseFileName];
otherwise
end
end
set(handles.lstImageList,'string',ListOfImageNames);
return
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!