如何使用ToolsApi应用不同的值IDE SizeFont后刷新Delphi IDE?

时间:2017-04-13 14:08:12

标签: delphi toolsapi otapi

我正在尝试在应用新字体大小后刷新我的IDE。代码是:

procedure TEditorFontSizeController.ChangeFontSize(Delta: Integer);
var
  IdeServices: IOTAServices;
  EnvironmentOptions: IOTAEnvironmentOptions;
  CurValue: Integer;
  NewValue: Integer;
begin
  if not Supports(BorlandIDEServices, IOTAServices, IdeServices) then
    Exit;

  EnvironmentOptions := IdeServices.GetEnvironmentOptions;

  CurValue := EnvironmentOptions.Values['FontSize'];
  NewValue := CurValue + Delta;

  if (NewValue <= 7) or (NewValue >= 256) then
    Exit;

  EnvironmentOptions.Values['FontSize'] := NewValue;
  RefreshScreen;
end;

如果我从IDE打开编辑器选项,我可以看到新值已正确应用,但当我单击工具选项屏幕上的确定按钮时,它只反映在IDE中。 如何直接从代码中应用它?

0 个答案:

没有答案