fmpatchdetails.pas

来自「Delphi的另一款钢琴软件」· PAS 代码 · 共 66 行

PAS
66
字号
unit fmPatchDetails;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ComCtrls, cmpInstrument;

type
  TPatchDetailsForm = class(TForm)
    btnOk: TBitBtn;
    btnCancel: TBitBtn;
    Label1: TLabel;
    edBankNo: TEdit;
    UpDown1: TUpDown;
    Label2: TLabel;
    edPatchNo: TEdit;
    UpDown2: TUpDown;
    Label3: TLabel;
    edPatchName: TEdit;
    Label4: TLabel;
    edComment: TEdit;
    GroupBox1: TGroupBox;
    elvPatchTypes: TListView;
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    SelectedPatchType : TPatchType;
    { Public declarations }
  end;

var
  PatchDetailsForm: TPatchDetailsForm;

implementation

{$R *.DFM}

procedure TPatchDetailsForm.FormShow(Sender: TObject);
var
  PatchType : TPatchType;
  Item : TListItem;
begin
  for PatchType := Low (TPatchType) to High (TpatchType) do
  begin
    item := elvPatchTypes.Items.Add;
    item.ImageIndex := Ord (PatchType);
    item.Caption := PatchTypeNames [PatchType]
  end;
  elvPatchTypes.Selected := elvPatchTypes.Items.Item [Ord (SelectedPatchType)];
  elvPatchTypes.ScrollBy (0, 100);
end;                    
                   
procedure TPatchDetailsForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if Assigned (elvPatchTypes.Selected) then
    SelectedPatchType := TPatchType (elvPatchTypes.Selected.Index)
  else
    SelectedPatchType := Low (TPatchType);
end;

end.

⌨️ 快捷键说明

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