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

📄 listboxhelperform.pas

📁 source code for Marco Cantu s book Delphi 2007 Handbook
💻 PAS
字号:
unit ListboxHelperForm;

interface

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

type
  TForm10 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form10: TForm10;

implementation

{$R *.dfm}

type
  TListboxHelper = class helper for TListBox
    function ItemIndexValue: string;
  end;


procedure TForm10.Button1Click(Sender: TObject);
begin
  ShowMessage (ListBox1.ItemIndexValue);
//  ShowMessage (
//    ListBox1.Items [ListBox1.ItemIndex]);
end;

{ TListboxHelper }

function TListboxHelper.ItemIndexValue: string;
begin
  Result := '';
  if ItemIndex >= 0 then
    Result := Items [ItemIndex];
end;

end.

⌨️ 快捷键说明

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