发现 TSplitter 在嵌套时不好用, 索性写了个替代品(处理MouseDown,MouseMove,MouseUp,然后设定控件的Left值就可以了)
代替 TSplitter 的 TDirPanel 类:
unit DirPanel; interface uses
Classes, Controls, Forms, ExtCtrls; type
TDirPanel = class(TCustomPanel)
private
FLine: TPanel;
B: Boolean;
F: Integer;
protected
procedure LineMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer);
procedure LineMouseMove(Sender: TObject; Shift: TShiftState; X: Integer; Y: Integer);
procedure LineMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer);
public
constructor Create(AOwner: TComponent; aAlign: TAlign = alLeft); reintroduce;
destructor Destroy; override;
published end; implementation { TDirPanel } constructor TDirPanel.Create(AOwner: TComponent; aAlign: TAlign);
begin
inherited Create(AOwner);
FLine := TPanel.Create(Self);
FLine.Parent := Self;
case aAlign of
alTop: begin
FLine.Align := alBottom;
FLine.Height := ;
FLine.Cursor := crVSplit;
Constraints.MaxHeight := Screen.Height div ;
Constraints.MinHeight := FLine.Height;
end;
alLeft: begin
FLine.Align := alRight;
FLine.Width := ;
FLine.Cursor := crHSplit;
Constraints.MinWidth := FLine.Width;
Constraints.MaxWidth := Screen.Width div ;
end;
end; Align := aAlign;
BevelOuter := bvNone; FLine.OnMouseDown := LineMouseDown;
FLine.OnMouseMove := LineMouseMove;
FLine.OnMouseUp := LineMouseUp;
end; destructor TDirPanel.Destroy;
begin
FLine.Free;
inherited;
end; procedure TDirPanel.LineMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
B := True;
case Align of
alTop: F := Y;
alLeft: F := X;
end;
end; procedure TDirPanel.LineMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if not B then Exit;
case Align of
alTop: Height := Height + Y - F;
alLeft: Width := Width + X - F;
end;
end; procedure TDirPanel.LineMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
B := False;
end; end.
调用测试:
unit Unit1; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, OleCtrls, SHDocVw, DirPanel; type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end; var
Form1: TForm1; implementation {$R *.dfm} var
dir1,dir2: TDirPanel;
body: TPanel;
web: TWebBrowser;
memo: TMemo; procedure TForm1.FormCreate(Sender: TObject);
begin
body := TPanel.Create(Self);
body.Parent := Self;
body.Align := alClient;
body.BevelOuter := bvNone; dir1 := TDirPanel.Create(Self);
dir2 := TDirPanel.Create(Self, alTop);
dir1.Parent := Self;
dir2.Parent := body; web := TWebBrowser.Create(Self);
TControl(web).Parent := dir1;
web.Align := alClient;
web.Navigate('http://del.cnblogs.com'); memo := TMemo.Create(Self);
memo.Parent := dir2;
memo.Align := alClient;
memo.Text := 'memo';
end; end.
http://www.cnblogs.com/del/archive/2011/05/12/2044635.html
发现 TSplitter 在嵌套时不好用, 索性写了个替代品(处理MouseDown,MouseMove,MouseUp,然后设定控件的Left值就可以了)的更多相关文章
- 如何解决FormView中实现DropDownList连动选择时出现 "Eval()、XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用" 的错误
原文:如何解决FormView中实现DropDownList连动选择时出现 "Eval().XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用" 的 ...
- 关于jquery在页面初始化时radio控件选定默认值的问题
网上找了很多资料,都是比较旧版本的方法,新版的jquery都已经抛弃了. 正确的代码是 $('input:radio[name="statusRadios"][value=&quo ...
- 无记录时显示gridview表头,并增加一行显示“没有记录”【绑定SqlDataSource控件时】
原文发布时间为:2008-08-04 -- 来源于本人的百度文章 [由搬家工具导入] using System;using System.Data;using System.Configuration ...
- scrollview嵌套下拉控件嵌套recyclerview(不动第三方原基础自定义)
相信会碰到很多类似的需求,一个列表控件,然后控件上方的一个头部需要自定义,这样就不好有时候也不能加在列表控件的头部了,那必须得嵌套一层scrollview了,没毛病,那么一般的列表控件都是有上拉下拉的 ...
- 使用selenium时,使用从系统启动浏览器与通过自动化驱动方式启动浏览器控件ID不一样解决方法
最近遇到一个怪事,通过正常打开浏览器,按照正常的web登录然后点击进入系统流程,将各控件的ID识别成功,然后使用 python3+selenium写好脚本,高高兴兴的用脚本跑时老是提示找不到控件,然后 ...
- ComboBox中如何嵌套TreeView控件
在ComboBox中嵌套TreeView控件,有时候我们在设计界面的时候,由于界面设计的需要,我们需要将TreeView控件嵌套在ComboBox中,因为TreeView控件实在是太占用地方了,要 ...
- 母版页改变被嵌套的页面中的控件ID的解决方法
使用过模板页的朋友都会很纳闷,怎么页面的用js通过getElementById(“id”):找不到对象.查看了页面源代码才发现,原来控件的ID变了,这是母版页导致的.因为母版页怕母版页本身页面中的控件 ...
- PyQt Designer中连接信号和槽时为什么只能连接控件自己的信号和槽函数?
老猿在学习ListView组件时,想实现一个在ListView组件中选中一个选择项后触发消息给主窗口,通过主窗口显示当前选中的项的内容. 进入QtDesigner后,设计一个图形界面,其中窗口界面使用 ...
- DevExpres表格控件运行时动态设置表格列
本文是系列文章,陆续发表于电脑编程技巧与维护杂志. DevExpres产品是全球享有极高声誉的一流控件套包产品!国内典型用户包括:用友.金蝶.神州数码.工信部.中国石化.汉王科技等众多大中型科技型企业 ...
随机推荐
- Sublime Text3的react代码校验插件
之前写前端一直用的是jshint做语法检查,但jshint不支持JSX语法,为了在React使用,需要用eslint代替它.六月份的时候为了写React Native,编辑器换过Webstorm和VS ...
- zlib minizip 实现解压zip
#include <stdio.h> #include <string.h> #include "unzip.h" #define dir_delimter ...
- 道量化交易程序猿(25)--Cointrader之MarketData市场数据实体(12)
转载注明出处:http://blog.csdn.net/minimicall.http://cloudtrade.top/ 前面一节我们说到了远端事件.当中.市场数据就属于远端事件.市场数据有什么?我 ...
- Java并发编程:synchronized和Lock
转自 : http://www.tuicool.com/articles/qYFzUjf
- Focusable 属性和IsTabStop 属性之间的关系
原文:Focusable 属性和IsTabStop 属性之间的关系 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/Libby1984/article ...
- PHP采集类:Snoopy.class.php
Snoopy是一个php采集类,用来模拟浏览器获取网页内容和发送表单. 下面是一些Snoopy特性: 容易抓取网页内容 容易抓取页面文本(去除HTML标签) 容易抓取网页内链接 支持代理抓取 支持基本 ...
- 1-5设定NetCore监听端口
问题的起源:启动一个.netCore项目,默认使用的是5000端口,当我们有很多个项目的时候(集群),不可能都使用5000端口. 方法1:set ASPNETCORE_URLS=http://127. ...
- WPF程序加入3D模型
原文:WPF程序加入3D模型 版权声明:本文为博主原创文章,转载请附上链接地址. https://blog.csdn.net/ld15102891672/article/details/8006474 ...
- sklearn、theano、TensorFlow 以及 theras 的理解
sklearn ⇒ 机器学习算法和模型: theras theano TensorFlow 1. 理解模型以及函数,参数返回值的实际意义 一定要注意模型的构造函数,接收的参数列表,以及该模型本身所要解 ...
- malloc()与calloc差异
Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each operates slig ...