超值的上海装潢公司:delphi listbox控件的一个简单问题?

来源:百度文库 编辑:高校问答 时间:2024/04/28 00:32:45
我在做东西的时候用到了listbox控件,里面有三条记录,分别是:界面设置,时间特效,文字特效,我想做的是,当鼠标单击时间特效后,标签中就显示时间特效字样,请问该怎么做?用什么事件,代码怎么写,我是一个初学delphi的学生,谢谢1

onchange时间,当点击某一记录时调用不同的程序。

unit Unit1;

interface

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

type
TForm1 = class(TForm)
Label1: TLabel;
ListBox1: TListBox;
procedure ListBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ListBox1Click(Sender: TObject);
begin
Label1.Caption:=ListBox1.Items[ListBox1.ItemIndex];
end;

end.