1.如果要创建一个mdi child,先看是否有这个child 存在,如果有,则用它,如果没有再创建 //该函数判断MDI 子窗体是否存在,再进行创建和显示function isInclude(formclass: TFormClass): boolean;var i: Integer; form: TObject;begin result := false; for i := 0 to frmMain.MDIChildCount do begin form := frmMain
//第一种方式 procedure TForm1.btn1Click(Sender: TObject); begin With TForm2.Create(Application) do Try ShowModal; finally free; end; end; //第二种方式 procedure TForm1.btn2Click(Sender: TObject); begin if not assigned(Form2) then begin Form2:=TForm2.Create(nil
windows api,一个窗体激活的时候给另外一个发消息 using System; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsApplication43 { public partial class Form1 : Form { Form frm =null; public Form1() { InitializeComponent(); this.Activated