function w = getGraphicalBorderWidth(h)
% Return width of uipanel graphical border in pixels.

%   Copyright 2010 The MathWorks, Inc.

% Width is returned in pixels from BorderWidth property, regardless of
% setting of units property.  If BorderType is set to 'EtchedIn' or
% 'EtchedOut', the width of the graphical border is twice the reported
% value.

if strncmpi(h.BorderType,'etched',6)
    scale = 2;
else
    scale = 1; % For border type line
end
w = scale * h.BorderWidth;
