看别人程序时候发现里面有很多诸如:
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编辑过]