How to refresh Delphi environment after applying different IDE SizeFont value using ToolsApi?

I am trying to update my IDE after applying a new font size. Code:

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;

      

If I open the editor options from the IDE, I see that the new values โ€‹โ€‹have been applied correctly, but they just reflect in the IDE when I click OK on the Tool Options screen. How can I apply it directly from code?

+3


source to share





All Articles