All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
asp.net实现站点RSS功能_[Asp.Net教程]
C#中动作类型控件应用实例
PHP将汉字转换拼音_[PHP教程]
用php实现gb2312和unicode(UTF-8)间的编码转换_[PHP教程]
初学来看:动态网页制作技术PHP的变量类型_php资料_编程技术
C#教程:注册表概述
mssql用存储过程实现分页功能_mssql学习_编程技术
C#中TreeView控件应用实例
在ASP.NET,2.0中使用RDLC格式的报表的问题_.net资料_编程技术
详细讲解PHP中缓存技术的应用_php资料_编程技术
Reading number is top 10 pictures
世界各国15岁的MM有什么不同
Absolutely shocked. National geographic 50 animal photographys4
The real super beauty2
Summer is most suitable for young people to travel in China9
Thrilling English baby
So beauty, will let you spray blood5
The money of more than 100 countries and regions16
Plump, too plump!1
30 beautiful school beauty5
The little girl with long hair2
Download software ranking
jdk1.6 for windows
双旗镇刀客B
美女写真1
C#程序员参考手册
Proficient in JavaScript
Sora aoi - one of more PK
仙剑奇侠传98版歌曲
Boxer's Top ten classic battle7
VC++6.0简体中文版
虚拟机汉化软件
aaa published in(发表于) 2014/7/19 0:12:28 Edit(编辑)
delphi类中方法的使用技巧和实例

delphi类中方法的使用技巧和实例

Delphi类qq的程序界面实例

Delphi类qq的程序界面实例

实例说明

    一般程序都是以菜单栏和工具栏的形式调用其他功能模块的,如果以动态的类qq的程序界面来调用其他模块将会给用户一种新鲜的感觉,使用户对软件更感兴趣。效果如图1.15所示。



技术要点

    本实例主要使用TPanel组件来完成布局,使用TListView组件来显示带图标的功能菜单。TListView组件的常用属性及说明如下:

Items: 使用该属性可直接访问表示列表中项目的TListItem对象。

Selected:使用该属性可访问列表中第1个所选项的属性。SelCount属性为0时,该属性为空;大于1时,后来选择的项通过GetNextItem方法查找项目的Selected属性定位。

实现过程

1.新建一个工程,该工程会自动创建一个主窗体,默认命名为Form1.

2.在窗体上添加TPanel、TlistView和TImageList组件。设置TListView组件的ImageList属性为TImageList组件。

3.程序代码如下:

procedure TForm1.Panel2Click(Sender: TObject);

var

  newitem:Tlistitem;

begin

  panel_click(sender);

  newitem:=Tlistitem.Create(nil);

  Listview1.Clear;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′one′;

  newitem.ImageIndex:=2;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′two′;

  newitem.ImageIndex:=3;

end;

procedure TForm1.panel_click(Sender: TObject);

var

  i:integer;

begin

  for i:=0 to self.ComponentCount-1 do

  begin

    if (self.Components[i] is TPanel) then

    begin

      if (Tpanel(self.Components[i]).Tag>0) and (Tpanel(self.Components[i]).Tag<5) then

      begin

        if Tpanel(self.Components[i]).Tag=Tpanel(sender).Tag then

          Tpanel(self.Components[i]).Align:=alTop

        else

          Tpanel(self.Components[i]).Align:=alBottom;

      end;

    end;

  end;

end;

procedure TForm1.Panel3Click(Sender: TObject);

var

  newitem:Tlistitem;

begin

  panel_click(sender);

  newitem:=Tlistitem.Create(nil);

  Listview1.Clear;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′three′;

  newitem.ImageIndex:=4;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′four′;

  newitem.ImageIndex:=5;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′AA′;

  newitem.ImageIndex:=9;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′BB′;

  newitem.ImageIndex:=10;

end;

procedure TForm1.Panel4Click(Sender: TObject);

var

  newitem:Tlistitem;

begin

  panel_click(sender);

  newitem:=Tlistitem.Create(nil);

  Listview1.Clear;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′sever′;

  newitem.ImageIndex:=6;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′six′;

  newitem.ImageIndex:=7;

end;

procedure TForm1.Panel5Click(Sender: TObject);

var

  newitem:Tlistitem;

begin

  panel_click(sender);

  newitem:=Tlistitem.Create(nil);

  Listview1.Clear;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′eleven′;

  newitem.ImageIndex:=8;

  newitem:= Listview1.Items.Add;

  newitem.Caption:=′twice′;

  newitem.ImageIndex:=9;

end;

procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

var

  point:Tpoint;

begin

 if (button=mbRight) and (Listview1.Selected<>nil ) then

 begin

   GetCursorPos(point);

   PopupMenu1.Popup(point.X,point.Y);

 end;

end;

end.





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.