unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
procedure freeactive(sender:Tobject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}{ TForm1 }procedure TForm1.freeactive(sender: Tobject);
begin
if (sender is Tedit) or (sender is Tmemo) then
button1.SetFocus;
end;end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
procedure freeactive(sender:Tobject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}{ TForm1 }procedure TForm1.freeactive(sender: Tobject);
begin
if (sender is Tedit) or (sender is Tmemo) then
button1.SetFocus;
end;end.
procedure TForm1.Edit1Enter(Sender: TObject);
begin
SendMessage(form1.Handle, WM_NEXTDLGCTL, 0, 0);
end;
Enabled := False
Color:= clBtnFace;
ReadOnly:= True;
Ctl3D:= False;
BorderStyle:= bsNone;行了!好累呀!
Left = 184
Top = 56
Width = 65
Height = 33
AutoSize = False
Caption = 'Label'#20063#21487#20197#33258#21160#25442#34892'!'
WordWrap = True
end
这个方法可以接受焦点
qiubolecn(来自差生市)
的方法是将焦点转移到下一个控件
我觉得可以将edit和Memo禁止好点
borderstyle:=bsNone;
begin
with Label1 do begin
AutoSize := False;
WordWrap := True;
Width := 65;
Height := 33;
Caption := 'Label也可以自动换行';
end;
end;
还是tabstop:=false 比较好