
delphi listbox控件的一个简单问题?
我在做东西的时候用到了listbox控件,里面有三条记录,分别是:界面设置,时间特效,文字特效,我想做的是,当鼠标单击时间特效后,标签中就显示时间特效字样,请问该怎么做?...
我在做东西的时候用到了listbox控件,里面有三条记录,分别是:界面设置,时间特效,文字特效,我想做的是,当鼠标单击时间特效后,标签中就显示时间特效字样,请问该怎么做?用什么事件,代码怎么写,我是一个初学delphi的学生,谢谢1
展开
2个回答
展开全部
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.
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.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询