Changing background color of task list box and oth

2019-05-19 05:30发布

问题:

In Inno Setup, I am trying to change the color of the setup to white. The problem is that when I try to do it by the Unicode version of installer, in the Select Additional Task Screen, I am getting grey section (screenshot is below). The important part is that when I move to next screen and comes back to that screen again, that grey section is gone.

I am using following code, based on Inno Setup: How to change background color.

procedure CurPageChanged(CurPageID: Integer);
begin
  case CurPageID of
    wpWelcome: WizardForm.Color := WizardForm.WelcomePage.Color;
    wpFinished: WizardForm.Color := WizardForm.FinishedPage.Color;
    wpLicense: WizardForm.InnerPage.Color := clWhite;
    wpSelectDir: WizardForm.InnerPage.Color := clWhite;
    wpSelectTasks: WizardForm.TasksList.Color := clWhite;
    wpReady: WizardForm.ReadyMemo.Color := clWhite
  else
    WizardForm.Color := clWhite;
  end;
end;

回答1:

It seems that the checklist box does not repaint completely, when the color changes.

But actually your code is too complicated (and actually not even correct). You can set the color of all components directly in InitializeWizard, instead of CurPageChanged. This way, the list box has the correct color, when painted for the first time already.

procedure InitializeWizard();
begin
  WizardForm.Color := clWhite;
  WizardForm.InnerPage.Color := WizardForm.Color;
  WizardForm.TasksList.Color := WizardForm.Color; 
  WizardForm.ReadyMemo.Color := WizardForm.Color;
end;