| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 741 人关注过本帖
标题:TForm1.CreateLabels()从哪里来的啊
取消只看楼主 加入收藏
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
 问题点数:0 回复次数:3 
TForm1.CreateLabels()从哪里来的啊

看别人程序时候发现里面有很多诸如:
procedure TDesignForm.CreateLabels();
procedure TDesignForm.UpdateOne(i: Integer; j: Integer);
这样的过程应在什么地方双击写的呢?
而在FORM的事件中只有onActivate和onCreate有内容啊

大家帮我看看哈,谢谢先
程序我贴一部分出来看看的:
unit Design;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Tools; //TOOLS是自己定义的,没有贴出来

type
TDesignForm = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure UpdateOne(i: Integer; j: Integer);
procedure UpdateAll();
procedure CreateLabels();
procedure LabelMouseEnter(Sender: TObject);
procedure LabelMouseLeave(Sender: TObject);
procedure LabelClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
DesignForm: TDesignForm;
m_compArry: TLabelArray;
m_seq: Integer;

implementation

uses Main, ResizeGarage; //使用到其他的单元,自定义的
{$R *.dfm}

procedure TDesignForm.FormCreate(Sender: TObject);
begin
CreateLabels;
m_seq := Tools.Tool.m_seq;
end;

procedure TDesignForm.FormActivate(Sender: TObject);
begin
if m_seq <> Tools.Tool.m_seq then
begin
CreateLabels;
m_seq := Tools.Tool.m_seq;
end;

UpdateALL;
end;

procedure TDesignForm.UpdateOne(i: Integer; j: Integer);
begin
m_compArry[i,j].Color := Tools.Tool.GetColor(i, j);
end;

procedure TDesignForm.UpdateAll();
var
i,j: Integer;
begin
for i := Low(m_compArry) to High(m_compArry) do
for j := Low(m_compArry[i]) to High(m_compArry[i]) do
m_compArry[i,j].Color := Tools.Tool.GetColor(i, j);
end;

procedure TDesignForm.CreateLabels();
var
i,j: Integer;
begin
for i := Low(m_compArry) to High(m_compArry) do
for j := Low(m_compArry[i]) to High(m_compArry[i]) do
m_compArry[i,j].Free;
m_compArry := nil;
Tools.Tool.CreateLabelArray(m_compArry, self.Panel1);
for i := Low(m_compArry) to High(m_compArry) do
for j := Low(m_compArry[i]) to High(m_compArry[i]) do
begin
m_compArry[i,j].OnMouseEnter := self.LabelMouseEnter;
m_compArry[i,j].OnMouseLeave := self.LabelMouseLeave;
m_compArry[i,j].OnClick := self.LabelClick;
end;
end;

procedure TDesignForm.LabelMouseEnter(Sender: TObject);
var
name: String;
i,j: Integer;
begin
name := TLabel(Sender).Name;
i := Tools.Tool.GetIFromStr(name);
j := Tools.Tool.GetJFromStr(name);

if Tools.Tool.IsRoad(i,j) then
TLabel(Sender).Caption := '通道'
else
TLabel(Sender).Caption := '车位';
end;

procedure TDesignForm.LabelMouseLeave(Sender: TObject);
begin
TLabel(Sender).Caption := '';
end;

procedure TDesignForm.LabelClick(Sender: TObject);
var
name: String;
i,j: Integer;
begin
name := TLabel(Sender).Name;
i := Tools.Tool.GetIFromStr(name);
j := Tools.Tool.GetJFromStr(name);
Tools.Tool.ChangeType(i, j);

if Tools.Tool.IsRoad(i,j) then
TLabel(Sender).Caption := '通道'
else
TLabel(Sender).Caption := '车位';

UpdateOne(i, j);
end;

procedure TDesignForm.Button1Click(Sender: TObject);
begin
ResizeGarage.ResizeForm.Edit1.Text := IntToStr(Tools.Tool.m_rows);
ResizeGarage.ResizeForm.Edit2.Text := IntToStr(Tools.Tool.m_columns);
ResizeGarage.ResizeForm.Show;
Self.Hide;
end;

procedure TDesignForm.Button2Click(Sender: TObject);
begin
Main.MainForm.Show;
Self.Hide;
end;

end.

[此贴子已经被作者于2007-2-13 20:38:33编辑过]

搜索更多相关主题的帖子: interface procedure Windows Design 
2007-02-13 15:36
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 
恩,是的。
我把一部分程序贴出来了,大家帮我看看哈
谢谢

[此贴子已经被作者于2007-2-13 20:39:41编辑过]


2007-02-13 20:33
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 
恩,理解了.谢谢大家的帮忙

2007-02-18 18:13
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 

就是说
procedure TDesignForm.LabelMouseEnter(Sender: TObject);
var
name: String;
i,j: Integer;
begin
name := TLabel(Sender).Name;
i := Tools.Tool.GetIFromStr(name);
j := Tools.Tool.GetJFromStr(name);

if Tools.Tool.IsRoad(i,j) then
TLabel(Sender).Caption := '通道'
else
TLabel(Sender).Caption := '车位';
end;
是上面自定义的过程要实现的操作吗?


2007-02-18 18:19
快速回复:TForm1.CreateLabels()从哪里来的啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016183 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved