获取窗口边框的宽度和标题栏的高度

方法一(通过 Width、ClientWidth 推算):

var

  frame,caption: Integer;

begin

  frame := (Width - ClientWidth) div 2;

  caption := Height - ClientHeight - frame * 2;

  ShowMessageFmt('边框宽: %d; 标题高: %d', [frame,caption]); {边框宽: 4; 标题高: 26}

end;


 
   
方法二(用 GetSystemMetrics 函数获取):

var

  frame,caption: Integer;

begin

  frame := GetSystemMetrics(SM_CXFRAME);

  caption := GetSystemMetrics(SM_CYCAPTION);

  ShowMessageFmt('边框宽: %d; 标题高: %d', [frame,caption]); {边框宽: 4; 标题高: 26}

end;


 
   

你可能感兴趣的:(获取)