procedure TForm1.Button1Click(Sender: TObject);
begin
Table1.Open;
if Table1.Active then
Begin
Button1.Caption:='连接成功';
//...
end
else
Begin
Button1.Caption:='连接失败';
//...end;
end;
begin
Table1.Open;
if Table1.Active then
Begin
Button1.Caption:='连接成功';
//...
end
else
Begin
Button1.Caption:='连接失败';
//...end;
end;
if table1.active then
button1.cation := 'open'
else
button1.cation := 'close'
begin
if button1.caption:='连接' then
begin
Table1.Open;
button1.caption:='断开';
//....
end
else
begin
Table1.close;
button1.caption:='连接';
//...end;
end;
这个怎么样??
if Table1.Active then
button1.caption:='连接'
else
button1.caption:='断开';
Table1.Active:=not Table1.Active;
if Table1.Active then
button1.caption:='断开'
else
button1.caption:='连接';
stattext : array [0..`1] of string = ('连接','断开');table1.active := not table1.active;
button1.caption := stattext[integer(table1.active)];
button1.cation := '断开';
if table1.active then button1.cation := '连接';
....ontimer(...)
begin
if table1.active=true then
button1.caption:='断开'
else
button1.caption:='连接';end;在 button的onclick 加上:
begin
table1.active:=not table1.active;
end;就行了
楼上各位,短线怎么办? 哈哈,设置caption最好是用Timer
....ontimer(...)
begin
if table1.active=true then
button1.caption:='断开'
else
button1.caption:='连接';end;在 button的onclick 加上:
begin
table1.active:=not table1.active;
end;就行了