即变化了width和height后,只刷新页面一次?
我有在oncanresize里控制,但结果是只能变化width或height代码:
procedure tform1.setformsize;
begin
  self.tag := 1;
  if IsFormMax then
  begin
    self.width := 800;
    self.height := 600;
    //self.setbounds(0,0,500,500);//也会刷两次
  end
  else
  begin
    self.width := 1024;
    self.height := 768;
    //self.setbounds(0,0,500,500);//也会刷两次
  end;
  self.tag := 0;
end;...
procedure tform1.FormCanResize(Sender: TObject; var NewWidth,
  NewHeight: Integer; var Resize: Boolean);
begin
  resize := self.tag = 0;
end;

解决方案 »

  1.   

    改变width时 触发一次     改变height时 触发一次   就是两次了
      

  2.   

    改变width时 触发一次    改变height时 触发一次 就是两次了
    ==============
    怎么只触发一次呢?
      

  3.   

    在 self.width := 800;  前后各加一句
    变成
    Self.OnCanResize := nil;
    self.width := 800; 
    Self.OnCanResize := FormCanResize;
      

  4.   

    SetBounds(Left,Top,the_Width,the_Height);
      

  5.   

    SetBounds(Left,Top,the_Width,the_Height);还是会两次
    用SetWindowPos(倒是减少了些刷新时间,估计是只刷了一次
      

  6.   

    要不你先visible 设为不可见,设置完后再显示
      

  7.   

    LockWindowUpdate 并不会减少刷新的次数
      

  8.   

    要不你先visible 设为不可见,设置完后再显示
    =============
    不可行