How to prevent resizing larger than a certain amount
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi All, I have a GUI I make programatically and the size it starts at is full screen (i.e. in the figure(property,value...'Position',get(0,'screensize'),...)
I want to know if there is a way to prevent users from resizing it larger but still be able to resize it smaller. Apart from the Figure size, everything is in normalized units. I have a dual monitor set up (laptop with external monitor) and the figure first shows at the full screen of my laptop window. I want to be able to resize it smaller but not any larger than it's starting size (laptop full screen size).
I tried setting the figure resize function as:
function resizeMainFigure(hObject,eventdata)
% -------
% Prevent oversizing the window
% -------
newPosition = get(mainFigure,'position');
if newPosition(3) > scrsz(3); newPosition(3) = scrsz(3); end
if newPosition(4) > scrsz(4); newPosition(4) = scrsz(4); end
set(mainFigure, 'Position', newPosition);
end
Where scrsz = get(0,'screensize'); (it spans multiple functions) and mainFigure is the variable storing the figure handle. I'm using 2015A
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!