2017-08-27 5 views
-1

質問から言えば、私は左から始めて中央から入力を始めたいと思っています。UserInfoPageの入力方法を中央に揃えるには?

短いコード値:ここ

with WizardForm.UserInfoNameEdit do 
    begin 
    Left := ScaleX(104); 
    Top := ScaleY(182); 
    Width := ScaleX(233); 
    Height := ScaleY(31); 
    Font.Height := -19; 
    MaxLength := 30; 
    ParentFont := False; 
    end; 

一部の画像:

Exemples

Exemples

+0

いいえ、それはできません。そして、それは私にとってひどい考えのように見えます。 –

+0

[画像参照](http://i.imgur.com/iJaU4cz.png)。 – Thebig1825

+0

それは私がひどい考えによって何を意味するかです。 WindowsのGUIスタイルに従います。あなた自身を発明しないでください。 –

答えて

0

あなたの3枚目の画像によると、カスタムフォームを使用することができますし、中にあなたのコントロールを配置あなたのフォームの中心。

function CreateMyCustomUserDialog(): Boolean; 
var 
    Form: TSetupForm; 
    OKButton, CancelButton: TNewButton; 
    Label1: TLabel; 
    Edit1: TEdit; 
begin 
    Form := CreateCustomForm(); 
    try 
    Form.ClientWidth := ScaleX(256); 
    Form.ClientHeight := ScaleY(256); 
    Form.Caption := 'User Information'; 
    Form.CenterInsideControl(WizardForm, true); 

    OKButton := TNewButton.Create(Form); 
    OKButton.Parent := Form; 
    OKButton.Width := ScaleX(75); 
    OKButton.Height := ScaleY(23); 
    OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 10); 
    OKButton.Top := Form.ClientHeight - ScaleY(23 + 10); 
    OKButton.Caption := 'OK'; 
    OKButton.ModalResult := mrOk; 

    Label1 := TLabel.Create(Form); 
    Label1.Parent := Form; 
    Label1.Alignment := taCenter; 
    Label1.Caption := 'Username:'; 
    Label1.Width := Form.ClientWidth; 
    Label1.Height := ScaleY(23);  
    Label1.Top := 30;  

    Edit1 := TEdit.Create(Form); 
    Edit1.Parent := Form; 
    Edit1.Top := 50; 
    Edit1.Width := 100; 
    Edit1.Left := (Form.ClientWidth - Edit1.Width)/2; 
    Edit1.Text := 'Admin';   

    CancelButton := TNewButton.Create(Form); 
    CancelButton.Parent := Form; 
    CancelButton.Width := ScaleX(75); 
    CancelButton.Height := ScaleY(23); 
    CancelButton.Left := Form.ClientWidth - ScaleX(75 + 10); 
    CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10); 
    CancelButton.Caption := 'Cancel'; 
    CancelButton.ModalResult := mrCancel; 
    CancelButton.Cancel := True; 

    Form.ActiveControl := OKButton; 

    if Form.ShowModal() = mrOk then 
     MsgBox('You clicked OK.', mbInformation, MB_OK); 
    finally 
    Form.Free(); 
    end; 
end; 
+0

私はこのコードを持っています:[リンク](https://paste.ee/p/PSGqJ) – Thebig1825

+0

あなたのコードは完全ではありません。しかし、私はあなたがWizardForm.UserInfoPageを使用しているのを見ます。親フォームとして。だから、あなたが中心にしたいコントロールで、そのようなことを試してみませんか? 'Left:=(WizardForm.UserInfoPage.ClientWidth - Width)/ 2;' – DeadTrousers

関連する問題