It is found that tsplitter is not easy to use in nesting and simply writes a substitute

Source: Internet
Author: User
Tdirpanel class that replaces tsplitter:
Unit dirpanel; interfaceuses 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: = 5; fline. cursor: = crvsplit; constraints. maxheight: = screen. height Div 4; constraints. minheight: = fline. height; end; alleft: Begin fline. align: = alright; fline. width: = 5; fline. cursor: = crheat transport; constraints. minwidth: = fline. width; constraints. maxwidth: = screen. width Div 2; 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; 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; Procedure tdirpanel. linemouseup (Sender: tobject; button: tmousebutton; shift: tshiftstate; X, Y: integer); begin B: = false; end.
Call test:
 
Unit unit1; interfaceuses 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.