2012-07-30 10 views
10

Chcę pokazać zawartość jak na poniższym obrazie w kroku instalacji instalatora ... Użyłem notatki do pokazania treści .. ale memo nie jest odpowiednią kontrolą..as to wygląda jak pole tekstowe, jeśli użytkownik umieszcza skupić się na polu memo ... zobacz poniżej obrazu .. kiedy użytkownik wchodzi na tym etapie, pierwsze pole memo wybrano ... installation typeKontrola wyświetlania zawartości wielowierszowej w instalatorze instalacyjnym inno

+3

Użyj 'TLabel' lub' TNewStaticText' i ustaw dla nich 'WordWrap' na True i' AutoSize' na False. – TLama

Odpowiedz

8

użyć jednej TLabel lub składnik (TNewStaticText model TNewStaticText wydaje się być preferowany w programie InnoSetup) i należy go ustawić:

  • the WordWrap nieruchomość do True
  • własnością AutoSize do False

Następnie wystarczy rozciągnąć elementy do żądanej pozycji, a tekst będzie pasować do tego granic, podobnie jak w poniższym przykładzie:

[Setup] 
AppName=My Program 
AppVersion=1.5 
DefaultDirName={pf}\My Program 

[Code]  
const 
    LoremIpsum = 
    'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin mauris ' + 
    'lorem, ullamcorper sit amet tincidunt ac, varius at ante. Aenean pretium, ' + 
    'tortor non congue pharetra, ante urna consectetur mi, vitae congue arcu est ' + 
    'eleifend nisl.'; 

procedure InitializeWizard; 
var 
    CustomPage: TWizardPage; 
    StandardDescLabel: TLabel; 
    StandardRadioButton: TNewRadioButton; 
    AdvancedDescLabel: TLabel; 
    AdvancedRadioButton: TNewRadioButton; 
begin 
    CustomPage := CreateCustomPage(wpWelcome, 'Installation type', ''); 
    StandardRadioButton := TNewRadioButton.Create(WizardForm); 
    StandardRadioButton.Parent := CustomPage.Surface; 
    StandardRadioButton.Checked := True; 
    StandardRadioButton.Top := 16; 
    StandardRadioButton.Width := CustomPage.SurfaceWidth; 
    StandardRadioButton.Font.Style := [fsBold]; 
    StandardRadioButton.Font.Size := 9; 
    StandardRadioButton.Caption := 'Standard Installation' 
    StandardDescLabel := TLabel.Create(WizardForm); 
    StandardDescLabel.Parent := CustomPage.Surface; 
    StandardDescLabel.Left := 8; 
    StandardDescLabel.Top := StandardRadioButton.Top + StandardRadioButton.Height + 8; 
    StandardDescLabel.Width := CustomPage.SurfaceWidth; 
    StandardDescLabel.Height := 40; 
    StandardDescLabel.AutoSize := False; 
    StandardDescLabel.Wordwrap := True; 
    StandardDescLabel.Caption := LoremIpsum; 
    AdvancedRadioButton := TNewRadioButton.Create(WizardForm); 
    AdvancedRadioButton.Parent := CustomPage.Surface; 
    AdvancedRadioButton.Top := StandardDescLabel.Top + StandardDescLabel.Height + 16; 
    AdvancedRadioButton.Width := CustomPage.SurfaceWidth; 
    AdvancedRadioButton.Font.Style := [fsBold]; 
    AdvancedRadioButton.Font.Size := 9; 
    AdvancedRadioButton.Caption := 'Advanced Installation' 
    AdvancedDescLabel := TLabel.Create(WizardForm); 
    AdvancedDescLabel.Parent := CustomPage.Surface; 
    AdvancedDescLabel.Left := 8; 
    AdvancedDescLabel.Top := AdvancedRadioButton.Top + AdvancedRadioButton.Height + 8; 
    AdvancedDescLabel.Width := CustomPage.SurfaceWidth; 
    AdvancedDescLabel.Height := 40; 
    AdvancedDescLabel.AutoSize := False; 
    AdvancedDescLabel.Wordwrap := True; 
    AdvancedDescLabel.Caption := LoremIpsum; 
end; 

A wynik:

+0

Ustawienie "AutoSize" na "Fałsz" jest niepotrzebne zgodnie z [dokumentami] (http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/StdCtrls_TLabel_AutoSize.html). I właśnie to przetestowałem i wygląda na to, że działa dobrze z 'AutoSize' na' True'. – Ignitor

+0

@ Igngitor, zatrzymam to tam. Tak właśnie jest w przypadku, gdy etykieta powinna być autosynchronizowana. Jak wspomniano w dokumentach, * "rozmiar etykiety zmienia się zawsze, gdy zmienia się tekst" * i zmieniam ją, prawda? – TLama

+0

Cóż, pytanie jest następujące: jeśli nie chcesz, aby etykieta automatycznie dostosowywała ** jej wysokość **, to ustaw "AutoSize" na "False". Nawet z 'AutoSize: = True;', etykieta będzie __nie zmieniać jej szerokości__, gdy włączona jest opcja "WordWarp". Chciałem jednak przede wszystkim zwrócić uwagę, że ** nie jest konieczne ustawienie "AutoSize: = False" dla 'WordWrap: = True' do pracy **. – Ignitor

Powiązane problemy