RZSplitter分割控件使用有关问题
RZSplitter分割控件使用问题
现在遇到一个问题,RZSplitter中左右面板需要运行中互换,左边变为右边,右边变为左边,该如何实现?
------解决方案--------------------
可以单击panel试试看
现在遇到一个问题,RZSplitter中左右面板需要运行中互换,左边变为右边,右边变为左边,该如何实现?
------解决方案--------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzPanel, ExtCtrls, RzSplit, RzButton;
type
TForm1 = class(TForm)
rzspltr1: TRzSplitter;
rzpnl1: TRzPanel;
rzpnl2: TRzPanel;
btn1: TRzButton;
btn2: TRzButton;
procedure rzpnl1Click(Sender: TObject);
procedure rzpnl2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.rzpnl1Click(Sender: TObject);
begin
if rzpnl1.Parent=rzspltr1.UpperLeft.Pane then
begin
rzpnl2.Parent:=rzspltr1.UpperLeft.Pane;
rzpnl1.Parent:=rzspltr1.LowerRight.Pane;
end else
begin
rzpnl1.Parent:=rzspltr1.UpperLeft.Pane;
rzpnl2.Parent:=rzspltr1.LowerRight.Pane;
end;
end;
procedure TForm1.rzpnl2Click(Sender: TObject);
begin
if rzpnl1.Parent=rzspltr1.UpperLeft.Pane then
begin
rzpnl2.Parent:=rzspltr1.UpperLeft.Pane;
rzpnl1.Parent:=rzspltr1.LowerRight.Pane;
end else
begin
rzpnl1.Parent:=rzspltr1.UpperLeft.Pane;
rzpnl2.Parent:=rzspltr1.LowerRight.Pane;
end;
end;
end.
可以单击panel试试看