panel.width:=?
panel.height:=?
panel.height:=?
解决方案 »
- 关于一个简单加密算法的问题
- delphi中rewrite怎么用的啊
- 跪求:请问有没有谁修改过anyQ 的源码, 配置安装 anyQ成功过的?急.......
- 错误"新事务不能登记到指定的事务处理器"???
- 想问高手如何用vfp调用DELPHI编写的DLL?
- 长沙--急招Delphi+SQL2000开发人员,13787108787刘经理。
- 如何知道一个线程已经退出?
- 为什么对数据库操作,CPU的占用率总是100%?
- 如何把OpenDialog同时选中的多个文件顺次播放?
- <<Delphi5實務經典>>書中寫錯了嗎?!錯了嗎?!
- 如何动态建立构件,怎样访问它们?
- 如何在DBGrid中实现使用回车键,切换单元格编辑?
panel.height:=panel.height+100;或者改变panel的Align属性也可以。
在一个FORM上放三个控件,设置如下属性:
Panel1: Align-->alLeft
Splitter: Align-->alLeft
Panel2: Align-->alClient
运行看一下效果!根据你的需要再进行一些改变就行了!
//Unit1.pas
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
procedure Label2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Label2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Label2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}var mx,my:integer;
CanMove:Boolean;procedure TForm1.Label2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
CanMove:=True;
mx:=x;
end;procedure TForm1.Label2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if Canmove then
Panel1.Width:=Panel1.Width+X-mx;
end;procedure TForm1.Label2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
CanMove:=False;
end;procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
CanMove:=True;
my:=y;
end;procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if CanMove then
Panel1.Height:=Panel1.Height+Y-my;
end;end.//Unit1.dfm
object Form1: TForm1
Left = 150
Top = 124
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 120
TextHeight = 16
object Panel1: TPanel
Left = 88
Top = 80
Width = 201
Height = 145
Caption = 'Panel1'
TabOrder = 0
object Label1: TLabel
Left = 1
Top = 128
Width = 199
Height = 16
Cursor = crSizeNS
Align = alBottom
AutoSize = False
Caption = 'Label1'
OnMouseDown = Label1MouseDown
OnMouseMove = Label1MouseMove
OnMouseUp = Label2MouseUp
end
object Label2: TLabel
Left = 188
Top = 1
Width = 12
Height = 127
Cursor = crSizeWE
Align = alRight
AutoSize = False
Caption = 'Label2'
OnMouseDown = Label2MouseDown
OnMouseMove = Label2MouseMove
OnMouseUp = Label2MouseUp
end
end
end
panel.height:=bbb
一定能行的~!
TO:ybli(似懂非懂)
”我说的是用鼠标去拖,不是代码中写“—— li_zhifu(东北人)做的就是啊!!!您比我还菜鸟么?
作的很好呀.
procedure TFRMMDIMAIN.PanelfrmCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
resize :=true;
end;procedure TFRMMDIMAIN.PanelfrmMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if (x>=panelfrm.Width-1) and (x<=panelfrm.Width+1) then
begin
Cursor :=crHSplit;
end else
begin
Cursor :=crdefault;
end;
end;procedure TFRMMDIMAIN.PanelfrmMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button=mbLeft) then
panelfrm.Width :=x;
end;
这3个过程里面几句话就解决了