maintest.pas

来自「delphi 里做一个智能combo box 的程序。」· PAS 代码 · 共 41 行

PAS
41
字号
unit MainTest;

interface

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

type
  TForm1 = class(TForm)
    IncCombobox1: TIncCombobox;
    IncCombobox2: TIncCombobox;
    Label1: TLabel;
    procedure IncCombobox1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.IncCombobox1KeyPress(Sender: TObject; var Key: Char);
begin
// if the user keys <Enter> add the text to the combobox
  if Key = #13 then begin
    with (Sender as TIncCombobox) do begin
      AddOrMoveItem(Text);
      SelectAll;
    end;
    Key := #0;
  end;
end;

end.

⌨️ 快捷键说明

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