form.show里面调用了form.visible:=true,然后把窗体放在屏幕最前面 --------------- procedure TCustomForm.Show; begin Visible := True;//这就是form.visible:=true BringToFront; end; ------------- form.visible ----------- procedure TCustomForm.SetVisible(Value: Boolean); begin if fsCreating in FFormState then if Value then Include(FFormState, fsVisible) else Exclude(FFormState, fsVisible) else begin if Value and (Visible <> Value) then SetWindowToMonitor; inherited Visible := Value; end; end;
……
uses
Unit2;
……
begin
form2.Edit1.Text := 'aaa';
form2.Show; (or form2.ShowModal)
end;
直接在fom2中用fomm1.XXXXX的方式调用。
弹出form2可以用show或showmodal方法。一个弹出的窗口可以切换。一个不可以切换。
完了马上结贴!!!!!!!!!!!!!!!!!!!!!!!!!!!
谢谢谢谢!!
SHOW 和SHOWMODAL。
SHOW,是显示一个窗体,但你可以操作同一个APPLICATION的其他窗体(该操作是指直接用鼠标或键盘), 而SHOWMODAL 不可以,除非你关掉它。是独占方式的。
传递参数的问题有很多中,你可以在FORM1的VAR下申明全局变量,在FORM2里 USES一下,就可以直接使用,如果是控件,就得:FORM1。EDIT1; 这样使用。
DELPHI中的单元UNITS和C#中的名称空间有异曲同工之妙。
---------------
procedure TCustomForm.Show;
begin
Visible := True;//这就是form.visible:=true
BringToFront;
end;
-------------
form.visible
-----------
procedure TCustomForm.SetVisible(Value: Boolean);
begin
if fsCreating in FFormState then
if Value then
Include(FFormState, fsVisible) else
Exclude(FFormState, fsVisible)
else
begin
if Value and (Visible <> Value) then SetWindowToMonitor;
inherited Visible := Value;
end;
end;