📄 paraadd.pas
字号:
if (StringGrid1.Col=0) or (StringGrid1.Col=2) or
(StringGrid1.Row>12) then
StringGrid1.Options:=StringGrid1.Options-[goediting]
else
StringGrid1.Options:=StringGrid1.Options+[goediting];
//出现通道选择菜单
if (StringGrid1.Col=0) and (StringGrid1.Row>0) and (StringGrid1.Row<11) then
with StringGrid1 do
begin
ComboBox2.Visible:=True;
ComboBox2.SetFocus;
ComboBox2.Left:=CellRect(Col,Row).Left+14;
ComboBox2.Top:=CellRect(Col,Row).Top+114;
ComboBox2.Width:=StringGrid1.ColWidths[0];
ComboBox2.Height:=StringGrid1.RowHeights[StringGrid1.Row];
end;
end;
if ComboBox1.Text='动热稳定试验' then
//如果是动热稳定试验
begin
//设置不可编辑的单元格
if (StringGrid1.Col=0) or (StringGrid1.Col=2) or
(StringGrid1.Row>3) then
StringGrid1.Options:=StringGrid1.Options-[goediting]
else
StringGrid1.Options:=StringGrid1.Options+[goediting];
//出现通道选择菜单
if (StringGrid1.Col=0) and (StringGrid1.Row>0) and (StringGrid1.Row<2) then
with StringGrid1 do
begin
ComboBox2.Visible:=True;
ComboBox2.SetFocus;
ComboBox2.Left:=CellRect(Col,Row).Left+14;
ComboBox2.Top:=CellRect(Col,Row).Top+114;
ComboBox2.Width:=StringGrid1.ColWidths[0];
ComboBox2.Height:=StringGrid1.RowHeights[StringGrid1.Row];
end;
end;
with StringGrid1 do
tmpStr:=Cells[0,Row];
if Length(tmpStr)=5 then
ComboBox2.ItemIndex:=StrToInt(tmpStr[5])-1
else
if Length(tmpStr)=6 then
ComboBox2.ItemIndex:=StrToInt(tmpStr[5]+tmpStr[6])-1;
dxButton1.Enabled:=True;
end;
procedure TParaAddFrm.ComboBox2Exit(Sender: TObject);
begin
with StringGrid1 do
begin
//选择替换当前通道序号
Cells[Col,Row]:=ComboBox2.Text;
//隐藏通道序号下拉菜单
ComboBox2.Visible:=False;
end;
end;
procedure TParaAddFrm.ComboBox1Enter(Sender: TObject);
begin
//记录当前试验类型
TestItem:=ComboBox1.ItemIndex;
end;
procedure TParaAddFrm.ComboBox1Change(Sender: TObject);
var
I,J:Integer;
begin
if MessageBox(ParaAddFrm.Handle,'确定所选的试验类型吗?',
'提示',MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON1+MB_APPLMODAL)=IDNO then
begin
//如果不希望改变当前试验类型,则退出
ComboBox1.ItemIndex:=TestItem;
Exit;
end
else
//如果改变当前试验类型
begin
//记录当前试验类型
TestItem:=ComboBox1.ItemIndex;
if ComboBox1.Text='单分试验' then
//单分试验
begin
with StringGrid1 do
begin
for I:=0 to 2 do
for J:=1 to 12 do
Cells[I,J]:='';
for I:=1 to 5 do
Cells[0,I]:='控制'+IntToStr(I);
Cells[0,6]:='高压1~4';
Cells[0,7]:='延弧1~4';
Cells[2,1]:='合闸开关合闸';
Cells[2,2]:='试品分闸';
Cells[2,3]:='辅助开关分闸';
Cells[2,4]:='保护开关分闸';
Cells[2,5]:='燃弧开关分闸';
Cells[2,6]:='高压开锁';
Cells[2,7]:='延弧开锁';
end;
with StringGrid2 do
begin
for I:=0 to 1 do
for J:=1 to 23 do
Cells[I,J]:='';
Cells[0,1]:='N1(短路半波数)';
Cells[0,2]:='合闸开关合闸时间(ms)';
Cells[0,3]:='试品分闸时间(ms)';
Cells[0,4]:='试品燃弧时间(ms)';
Cells[0,5]:='辅助开关分闸时间(ms)';
Cells[0,6]:='辅助开关燃弧时间(ms)';
Cells[0,7]:='燃弧开关分闸时间(ms)';
Cells[0,8]:='t(燃弧开关在短路电流过零前t毫秒分闸)';
Cells[0,9]:='N2(短路电流过零后保护开关分闸错后半波数)';
Cells[0,10]:='保护开关分闸时间(ms)';
Cells[0,11]:='高压开锁时间(ms)';
Cells[0,12]:='延弧开锁时间(ms)';
end;
end;
if ComboBox1.Text='合分试验' then
//合分试验
begin
with StringGrid1 do
begin
for I:=0 to 2 do
for J:=1 to 12 do
Cells[I,J]:='';
for I:=1 to 6 do
Cells[0,I]:='控制'+IntToStr(I);
Cells[0,7]:='高压1~4';
Cells[0,8]:='延弧1~4';
Cells[2,1]:='合闸开关合闸';
Cells[2,2]:='试品合闸';
Cells[2,3]:='试品分闸';
Cells[2,4]:='辅助开关分闸';
Cells[2,5]:='保护开关分闸';
Cells[2,6]:='燃弧开关分闸';
Cells[2,7]:='高压开锁';
Cells[2,8]:='延弧开锁';
end;
with StringGrid2 do
begin
for I:=0 to 1 do
for J:=1 to 23 do
Cells[I,J]:='';
Cells[0,1]:='N1(短路半波数)';
Cells[0,2]:='合闸开关合闸时间(ms)';
Cells[0,3]:='试品合闸时间(ms)';
Cells[0,4]:='试品分闸时间(ms)';
Cells[0,5]:='试品燃弧时间(ms)';
Cells[0,6]:='辅助开关分闸时间(ms)';
Cells[0,7]:='辅助开关燃弧时间(ms)';
Cells[0,8]:='燃弧开关分闸时间(ms)';
Cells[0,9]:='t(燃弧开关在短路电流过零前t毫秒分闸)';
Cells[0,10]:='N2(短路电流过零后保护开关分闸错后半波数)';
Cells[0,11]:='保护开关分闸时间(ms)';
Cells[0,12]:='高压开锁时间(ms)';
Cells[0,13]:='延弧开锁时间(ms)';
end;
end;
if ComboBox1.Text='重合闸试验' then
//重合闸试验
begin
with StringGrid1 do
begin
for I:=0 to 2 do
for J:=1 to 12 do
Cells[I,J]:='';
for I:=1 to 12 do
case I of
1: Cells[0,I]:='控制1';
2,3: Cells[0,I]:='控制2';
4,5: Cells[0,I]:='控制3';
else
Cells[0,I]:='控制'+IntToStr(I-2);
end;
Cells[0,11]:='高压1~4';
Cells[0,12]:='延弧1~4';
Cells[2,1]:='合闸开关合闸';
Cells[2,2]:='试品分闸1';
Cells[2,3]:='试品分闸2';
Cells[2,4]:='辅助开关分闸1';
Cells[2,5]:='辅助开关分闸2';
Cells[2,6]:='辅助开关合闸';
Cells[2,7]:='试品合闸';
Cells[2,8]:='保护开关分闸';
Cells[2,9]:='燃弧开关分闸';
Cells[2,10]:='保护开关';
Cells[2,11]:='高压开锁';
Cells[2,12]:='延弧开锁';
end;
with StringGrid2 do
begin
Cells[0,1]:='N2(试品分闸2短路半波数)';
Cells[0,2]:='无电流时间(ms)';
Cells[0,3]:='N1(试品分闸1短路半波数)';
Cells[0,4]:='合闸开关合闸时间(ms)';
Cells[0,5]:='试品分闸1时间(ms)';
Cells[0,6]:='试品分闸1燃弧时间(ms)';
Cells[0,7]:='辅助开关分闸1时间(ms)';
Cells[0,8]:='辅助开关分闸1燃弧时间(ms)';
Cells[0,9]:='N3(短路电流一次过零后辅助开关分闸1燃弧时间)';
Cells[0,10]:='辅助开关合闸时间(ms)';
Cells[0,11]:='N1(试品分闸1短路半波数)';
Cells[0,12]:='试品合闸时间(ms)';
Cells[0,13]:='试品分闸2时间(ms)';
Cells[0,14]:='试品分闸2燃弧时间(ms)';
Cells[0,15]:='辅助开关分闸2时间(ms)';
Cells[0,16]:='辅助开关分闸2燃弧时间(ms)';
Cells[0,17]:='燃弧开关分闸时间(ms)';
Cells[0,18]:='t(燃弧开关在短路电流二次过零前t毫秒分闸)';
Cells[0,19]:='N4(短路电流二次过零后保护开关分闸错后半波数)';
Cells[0,20]:='保护开关分闸时间(ms)';
Cells[0,21]:='保护开关时间(ms)';
Cells[0,22]:='高压开锁时间(ms)';
Cells[0,23]:='延弧开锁时间(ms)';
end;
end;
if ComboBox1.Text='动热稳定试验' then
//动热稳定试验
begin
with StringGrid1 do
begin
for I:=0 to 2 do
for J:=1 to 12 do
Cells[I,J]:='';
Cells[0,1]:='控制1';
Cells[0,2]:='高压1~4';
Cells[0,3]:='延弧1~4';
Cells[2,1]:='保护开关合闸';
Cells[2,2]:='高压开锁';
Cells[2,3]:='延弧开锁';
end;
with StringGrid2 do
begin
for I:=0 to 1 do
for J:=1 to 23 do
Cells[I,J]:='';
Cells[0,1]:='保护开关合闸时间(ms)';
Cells[0,2]:='高压开锁时间(ms)';
Cells[0,3]:='延弧开锁时间(ms)';
end;
end;
if ComboBox1.Text='自定义试验' then
//自定义试验
begin
with StringGrid1 do
for I:=0 to 2 do
for J:=1 to 12 do
Cells[I,J]:='';
with StringGrid2 do
begin
for I:=0 to 1 do
for J:=1 to 23 do
Cells[I,J]:='';
Cells[0,1]:='';
Cells[0,2]:='';
Cells[0,3]:='';
end;
end;
dxButton1.Enabled:=True;
MainFrm.CaptionLbl.Caption:='合成试验('+ComboBox1.Text+')';
end;
oneSave:=0;
MainFrm.ParaData.Enabled:=False;
MainFrm.ParaDataBtn.Enabled:=False;
MainFrm.Reset.Enabled:=False;
MainFrm.ResetBtn.Enabled:=False;
MainFrm.TestRun.Enabled:=False;
MainFrm.TestRunBtn.Enabled:=False;
MainFrm.TestVer.Enabled:=False;
MainFrm.TestVerBtn.Enabled:=False;
MainFrm.WaveView.Enabled:=False;
MainFrm.WaveViewBtn.Enabled:=False;
end;
procedure TParaAddFrm.StringGrid1KeyPress(Sender: TObject; var Key: Char);
var
Str: String;
I: Integer;
begin
with StringGrid1 do
begin
if Col=1 then
begin
//只能输入数字和小数点
if key in ['0'..'9','.'] then
begin
Str:=Cells[1,Row];
if (key='.') and (Length(Str)>0) then
for I:=1 to Length(Str) do
if Str[I]='.' then
Key:=#0;
end
else
//允许回车键和退格键
if (key<>#8) and (key<>#13) then
key:=#0;
end;
end;
end;
procedure TParaAddFrm.StringGrid2Click(Sender: TObject);
begin
if ComboBox1.Text='单分试验' then
begin
//设置不可编辑的单元格
if (StringGrid2.Row>12) or (StringGrid2.Col=0) then
StringGrid2.Options:=StringGrid1.Options-[goediting]
else
StringGrid2.Options:=StringGrid1.Options+[goediting];
end;
if ComboBox1.Text='合分试验' then
begin
//设置不可编辑的单元格
if (StringGrid2.Row>13) or (StringGrid2.Col=0) then
StringGrid2.Options:=StringGrid1.Options-[goediting]
else
StringGrid2.Options:=StringGrid1.Options+[goediting];
end;
if ComboBox1.Text='重合闸试验' then
begin
//设置不可编辑的单元格
if (StringGrid2.Row>23) or (StringGrid2.Col=0) then
StringGrid2.Options:=StringGrid1.Options-[goediting]
else
StringGrid2.Options:=StringGrid1.Options+[goediting];
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -