Teach you to implement docking functions in Delphi7

Source: Internet
Author: User
Tags integer

We use DELPHI7 development application system process often need to use child windows in the main window docking function, if this part is not skilled, usually to csdn and other sites to find a variety of related controls, or refer to the Delphi with the routine docking, Let me introduce a simple method that can be used together.

1, in the main window to add four panel and four splitter, set alignment up and down four sides.

2, set the properties of the four panel Docksite property is true.

3, left and right panel to add Ondockdrop, Ondockover, Onundock events are as follows:

procedure TfrmMain.pnlLeftUnDock(Sender: TObject; Client: TControl;
NewTarget: TWinControl; var Allow: Boolean);
begin
if (Sender as TPanel).VisibleDockClientCount = 1 then
begin
(Sender as TPanel).Width := 1;
end;
end;
procedure TfrmMain.pnlLeftDockDrop(Sender: TObject;
Source: TDragDockObject; X, Y: Integer);
begin
(Sender as TPanel).Width := max(source.Control.UndockWidth,(Sender as TPanel).Width);
end;
procedure TfrmMain.pnlLeftDockOver(Sender: TObject;
Source: TDragDockObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
begin
if State = dsDragEnter then
begin
(Sender as TPanel).Width := max(Source.Control.UndockWidth, (Sender as TPanel).Width);
end
else
begin
if State = dsDragLeave then
begin
(Sender as TPanel).Width := 1;
end;
end;
end;

The left and right panel response event code is the same.

Related Article

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.