f_screen.asv

来自「digital signal processing常用工具箱」· ASV 代码 · 共 55 行

ASV
55
字号
function [fsize,horz,vert] = f_screen (warn)

%F_SCREEN: Compute the current graphics screen resolution
%
% Usage: [fsize,horz,vert] = f_screen (warn);
%
% Inputs:
%          warn = optional input.  If warn is present and 
%                 nonzero, issue a warning if the screen
%                 resolution is too low for the GUI
%                 modules (below 1024 x 768).
% Outputs: 
%          fsize = suggested fontsize, in points, for the
%                  GUI module text labels
%          horz  = horizontal resolution in  pixels
%          vert  = resolution in pixels

% Get screen resolution

screen = get (0,'ScreenSize');
horz = screen(3);
vert = screen(4);

% Set recommended font size

if (horz <= 640) | (vert <= 480)
    fsize = 6;
elseif (horz <= 800) | (vert <= 600)
    fsize = 7;
else
    fsize = 8;
end
 
% Issue warning if resolution is too low

if nargin < 1
    warn = 0;
end
swarn = getpref ('FDSP_preferences','screen_warning');
if warn & swarn
   msg = sprintf (['The GUI module screens have been designed to use a\n'...
                   'screen resolution of 1280 x 1024.  The current screen\n'...
                   'resolution is %d x %d pixels.  To reset your screen\n'...
                   'resolution: exit MATLAB, right click on the desktop, and\n'...
                   'select Properties/Settings.'],horz,vert);
   if (horz < 1280) | (vert < 1024)
     reply = questdlg (msg,'Screen Resolution Warning','Disable this warning',...
                       'Ok','Ok');
     if strcmp (reply,'Disable this warning')
         setpref ('FDSP_preferences','screen_warning',0)
     end
   end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?