📄 uselone.pas
字号:
unit uSelOne;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmSelOne = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
function SelectItem(Items: tstrings; var Selected: integer): string;
implementation
{$R *.dfm}
function SelectItem(Items: tstrings; var Selected: integer): string;
var
frmSelOne: TfrmSelOne;
begin
frmSelOne:= TfrmSelOne.Create(application);
try
frmSelOne.ListBox1.Items.Assign(Items);
if (Selected>=0) and (Selected<frmSelOne.ListBox1.Items.Count) then
frmSelOne.ListBox1.ItemIndex:=Selected;
if frmSelOne.ShowModal=mrok then
begin
selected := frmSelOne.ListBox1.ItemIndex;
if selected>=0 then
result := frmSelOne.ListBox1.Items[selected];
end;
finally
frmSelOne.Free;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -