function setfig2screensize(varargin)
%SETFIG2SCREENSIZE
%
% setfig2screensize sets current figure to screensize
%
% setfig2screensize(handle) sets the figure with handle 'handle'
% to screensize
%

% Copyright G.J. de Boer, TU Delft 2004

   figurehandle = [];
   if nargin==0
      figurehandle = gcf;
   elseif nargin==1
      figurehandle = varargin{1};
   end

   set(0,'Units','pixels') 
   screensize = get(0,'ScreenSize');
   width.windowstaskbar = 31;
   width.windowheader   = 68;
   width.windows        = 0;
   set(figurehandle,'Position',...
       [screensize(1) ,... 
        screensize(2) + width.windowstaskbar,...
        screensize(3) - 2*width.windows,...
        screensize(4) - width.windowstaskbar - width.windowheader]);
