軟件在運行期,修改panel的位置與大小

procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  if (x>=0)and(x<=3) then
  begin
    if (y>=0)and(y<=3) then Panel1.Perform(WM_SysCommand,$F004,0);
    if (y>3)and(y<Panel1.Height-3) then Panel1.Perform(WM_SysCommand,$F001,0);
    if (y>=Panel1.Height-3)and(y<=Panel1.Height) then Panel1.Perform(WM_SysCommand,$F007,0);
  end
  else if (x>3)and(x<Panel1.Width-3) then
  begin
    if (y>=0)and(y<=3) then Panel1.Perform(WM_SysCommand,$F003,0);
    if (y>3)and(y<Panel1.Height-3) then Panel1.Perform(WM_SysCommand,$F012,0);
    if (y>=Panel1.Height-3)and(y<=Panel1.Width) then Panel1.Perform(WM_SysCommand,$F006,0);
  end
  else if (x>=Panel1.Width-3)and(x<=Panel1.Width) then
  begin
    if (y>=0)and(y<=3) then Panel1.Perform(WM_SysCommand,$F005,0);
    if (y>3)and(y<Panel1.Height-3) then Panel1.Perform(WM_SysCommand,$F002,0);
    if (y>=Panel1.Height-3)and(y<=Panel1.Width) then Panel1.Perform(WM_SysCommand,$F008,0);
  end;
end;
 
 
 
 
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if (x>=0)and(x<=3) then
  begin
    if (y>=0)and(y<=3) then Panel1.Cursor:=crSizeNWSE;
    if (y>3)and(y<Panel1.Height-3) then Panel1.Cursor:=crSizeWE;
    if (y>=Panel1.Height-3)and(y<=Panel1.Height) then Panel1.Cursor:=crSizeNESW;
  end
  else if (x>3)and(x<Panel1.Width-3) then
  begin
    if (y>=0)and(y<=3) then Panel1.Cursor:=crSizeNS;
    if (y>3)and(y<Panel1.Height-3) then Panel1.Cursor:=crArrow;
    if (y>=Panel1.Height-3)and(y<=Panel1.Width) then Panel1.Cursor:=crSizeNS;
  end
  else if (x>=Panel1.Width-3)and(x<=Panel1.Width) then
  begin
    if (y>=0)and(y<=3) then Panel1.Cursor:=crSizeNESW;
    if (y>3)and(y<Panel1.Height-3) then Panel1.Cursor:=crSizeWE;
    if (y>=Panel1.Height-3)and(y<=Panel1.Width) then Panel1.Cursor:=crSizeNWSE;
  end;
end;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章