解决Delphi MDI 闪烁问题

procedure TMainForm.CreateMDIChild(const Name: string);
var
Child: TMDIChild;
begin
{ create a new MDI child window }
Perform(WM_SETREDRAW, 0, 0); //锁屏幕
Child := TMDIChild.Create(Application);
Child.WindowState := wsMaximized; //假设在这里将新建的子窗体设为最大化
//或设置子窗体的Width和Height都可以
Child.Caption := Name;
if FileExists(Name) then Child.Memo1.Lines.LoadFromFile(Name);
Perform(WM_SETREDRAW, 1, 0); //解锁屏幕并重画
RedrawWindow(Handle, Nil, 0, RDW_FRAME + RDW_INVALIDATE +
RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);
end;

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/aroc_lo/archive/2010/09/19/5895524.aspx

你可能感兴趣的:(Delphi)