⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ufrminfo.~pas

📁 Delphi课堂使用用例
💻 ~PAS
字号:
unit ufrmInfo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TfrmInfo = class(TForm)
    Label1: TLabel;
    edtName: TEdit;
    Label2: TLabel;
    edtPhone: TEdit;
    cmbAddress: TComboBox;
    lstCode: TListBox;
    Label3: TLabel;
    Label4: TLabel;
    edtMobile: TEdit;
    Label5: TLabel;
    cmbGender: TComboBox;
    btnOK: TButton;
    btnCancel: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    procedure ClearValues;
    procedure SetValues(ContactName, PhoneCode, HomePhone, Mobile,
      Gender: String);
    { Public declarations }
  end;

var
  frmInfo: TfrmInfo;

implementation

uses udmContact;

{$R *.dfm}

procedure TfrmInfo.ClearValues;
begin
    edtName.Text := '';
    cmbAddress.ItemIndex := -1;
    edtPhone.Text := '';
    edtMobile.Text := '';
    cmbGender.ItemIndex := 0;
end;

procedure TfrmInfo.FormCreate(Sender: TObject);
begin
    with dmContact.tbPhoneCode do
    begin
        Open;
        while not Eof do
        begin
            cmbAddress.Items.Add(FieldValues['PhoneAddress']);
            lstCode.Items.Add(FieldValues['PhoneCode']);
            Next;
        end;
        Close;
    end;
end;

procedure TfrmInfo.SetValues(ContactName, PhoneCode, HomePhone, Mobile,
  Gender: String);
begin
    edtName.Text := ContactName;
    cmbAddress.ItemIndex := lstCode.Items.IndexOf(PhoneCode);
    edtPhone.Text := HomePhone;
    edtMobile.Text := Mobile;
    cmbGender.ItemIndex := cmbGender.Items.IndexOf(Gender);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -