📄 addredit.pas
字号:
unit AddrEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, Spin, Buttons, ExtCtrls, Grids;
type
TFrmEditAddr=class(TForm)
AddrGrid: TStringGrid;
Panel1: TPanel;
BtnApplyAndClose: TButton;
ERowCount: TSpinEdit;
Label1: TLabel;
BtnApplyRow: TSpeedButton;
procedure FormCreate(Sender : TObject);
procedure BtnApplyRowClick(Sender : TObject);
procedure BtnApplyAndCloseClick(Sender : TObject);
procedure Open();
private
procedure sub_4A6864();
{ Private declarations }
public
{ Public declarations }
end ;
var
FrmEditAddr: TFrmEditAddr;
{This file is generated by DeDe Ver 3.50.02 Copyright (c) 1999-2002 DaFixer}
implementation
uses HUtil32, DBShare;
{$R *.DFM}
procedure TFrmEditAddr.FormCreate(Sender : TObject);
begin
ERowCount.Value:=8;
AddrGrid.Cells[0,0]:='角色选择网关地址';
AddrGrid.Cells[1,0]:='游戏网关';
AddrGrid.Cells[2,0]:='端口';
AddrGrid.Cells[3,0]:='游戏网关';
AddrGrid.Cells[4,0]:='端口';
AddrGrid.Cells[5,0]:='游戏网关';
AddrGrid.Cells[6,0]:='端口';
AddrGrid.Cells[7,0]:='游戏网关';
AddrGrid.Cells[8,0]:='端口';
end;
procedure TFrmEditAddr.BtnApplyRowClick(Sender : TObject);
begin
if ERowCount.Value < 1 then ERowCount.Value:=1;
AddrGrid.RowCount:=ERowCount.Value + 1;
end;
procedure TFrmEditAddr.BtnApplyAndCloseClick(Sender : TObject);
var
I,II: Integer;
SaveList:TStringList;
s14:String;
begin
SaveList:=TStringList.Create;
for I := 1 to AddrGrid.RowCount - 1 do begin
s14:=Trim(AddrGrid.Cells[0,i]);
if s14 <> '' then begin
s14:= s14 + ' ';
for II := 1 to AddrGrid.ColCount - 1 do begin
s14:=s14 + Trim(AddrGrid.Cells[ii,i]) + ' ';
end;
end;
SaveList.Add(s14);
end;
try
SaveList.SaveToFile(sGateConfFileName);
except
ShowMessage(sGateConfFileName + ' 保存异常!');
end;
Self.Close;
end;
procedure TFrmEditAddr.sub_4A6864();
var
i,ii:Integer;
begin
for i := 1 to AddrGrid.RowCount - 1 do begin
for ii := 0 to AddrGrid.ColCount - 1 do begin
AddrGrid.Cells[ii,i]:='';
end;
end;
end;
procedure TFrmEditAddr.Open();
var
LoadList:TStringList;
i,n18,n1C:Integer;
sStr:String;
sStr1:String;
begin
sub_4A6864();
LoadList:=TStringList.Create;
try
LoadList.LoadFromFile(sGateConfFileName);
except
ShowMessage(sGateConfFileName + ' 读取异常!');
end;
n1C:=1;
for I := 0 to LoadList.Count - 1 do begin
sStr:=Trim(LoadList.Strings[i]);
if (sStr <> '') and (sStr[1] <> ';') then begin
sStr:=GetValidStr3(sStr,sStr1,[#32,#9]);
AddrGrid.Cells[0,n1C]:=sStr1;
n18:=0;
while (true) do begin
if sStr <> '' then begin
sStr:=GetValidStr3(sStr,sStr1,[#32,#9]);
AddrGrid.Cells[n18 * 2 +1,n1C]:=sStr1;
sStr:=GetValidStr3(sStr,sStr1,[#32,#9]);
AddrGrid.Cells[n18 * 2 +2,n1C]:=sStr1;
Inc(n18);
if n18 <=4 then Continue;
end;
Inc(n1C);
if AddrGrid.RowCount <= n1C then
AddrGrid.RowCount:=AddrGrid.RowCount + 1;
break;
end;
end;
end;
LoadList.Free;
Self.ShowModal;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -