注册 登录
编程论坛 Delphi论坛

新人求教关于点击button产生panel的问题

aaron52088 发布于 2007-01-24 16:38, 612 次点击

运行程序的时,
在form中点击button后可以产生几个pannel,
现在我想直接在form中改变panel的大小和长短,怎么做啊?
我自己写了一个程序可以单独调整panel的大小,就是不知道怎么把这两个联系起来的。
以下是单独调整panel的程序:
procedure TForm1.Panel2MouseDown(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 Panel2.Perform(WM_SysCommand,$F004,0);
if (y>3)and(y<Panel2.Height-3) then Panel2.Perform(WM_SysCommand,$F001,0);
if (y>=Panel2.Height-3)and(y<=Panel2.Height) then Panel2.Perform(WM_SysCommand,$F007,0);
end
else if (x>3)and(x<Panel2.Width-3) then
begin
if (y>=0)and(y<=3) then Panel2.Perform(WM_SysCommand,$F003,0);
if (y>3)and(y<Panel2.Height-3) then Panel2.Perform(WM_SysCommand,$F012,0);
if (y>=Panel2.Height-3)and(y<=Panel2.Width) then Panel2.Perform(WM_SysCommand,$F006,0);
end
else if (x>=Panel2.Width-3)and(x<=Panel2.Width) then
begin
if (y>=0)and(y<=3) then Panel2.Perform(WM_SysCommand,$F005,0);
if (y>3)and(y<Panel2.Height-3) then Panel2.Perform(WM_SysCommand,$F002,0);
if (y>=Panel2.Height-3)and(y<=Panel2.Width) then Panel2.Perform(WM_SysCommand,$F008,0);
end;
end;

procedure TForm1.Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if (x>=0)and(x<=3) then
begin
if (y>=0)and(y<=3) then Panel2.Cursor:=crSizeNWSE;
if (y>3)and(y<Panel2.Height-3) then Panel2.Cursor:=crSizeWE;
if (y>=Panel2.Height-3)and(y<=Panel2.Height) then Panel2.Cursor:=crSizeNESW;
end
else if (x>3)and(x<Panel2.Width-3) then
begin
if (y>=0)and(y<=3) then Panel2.Cursor:=crSizeNS;
if (y>3)and(y<Panel2.Height-3) then Panel2.Cursor:=crArrow;
if (y>=Panel2.Height-3)and(y<=Panel2.Width) then Panel2.Cursor:=crSizeNS;
end
else if (x>=Panel2.Width-3)and(x<=Panel2.Width) then
begin
if (y>=0)and(y<=3) then Panel2.Cursor:=crSizeNESW;
if (y>3)and(y<Panel2.Height-3) then Panel2.Cursor:=crSizeWE;
if (y>=Panel2.Height-3)and(y<=Panel2.Width) then Panel2.Cursor:=crSizeNWSE;
end;
end;



刚刚接触delphi,希望大虾们可以帮帮我的。谢谢先

4 回复
#2
autosun2007-01-24 18:39
这个都做出来了,那个还不会很简单的!在想想!
#3
aaron520882007-01-25 09:05
因为这学期才学DELPHY的,
而且马上就要我们做毕业设计的,
所以掌握的没有很好,很多都是从书上了解的,
大虾,你就告诉小弟吧。
#4
aaron520882007-01-26 10:18
帮帮忙的大家
#5
基础DELPHI2007-01-26 11:52
把这几个做成过程(函数)(我也不清楚叫什么)
然后直接在CREATE里调用 试试?
1