Delphi 动态改变Rzsplitter的Orientation(方向)属性

效果图:

Delphi 动态改变Rzsplitter的Orientation(方向)属性

原先不知道,弄了半天都改不了RzSplitter.Orientation = orHorizontal / orVertical

然后去查该组件的源代码,原来Orientation不是在RzSplit单元定义的,而是在RzCommon这个单元,uses它后,一切正常了。

RzCommon Unit
//...
type
  TAlignmentVertical = ( avTop, avCenter, avBottom );

  TBlinkState = ( bsOn, bsOff );

  TTextStyle = ( tsNormal, tsRaised, tsRecessed, tsShadow );
  TOrientation = ( orHorizontal, orVertical );  //此处
  TBarStyle = ( bsTraditional, bsLED, bsGradient );
  TLineStyle = ( lsNone, lsFlat, lsGroove, lsBump );
//Button1 的 OnClick事件
procedure TForm1.Button1Click(Sender: TObject);
var
  w, h: Integer;
begin
  w := Ceil((RzSplitter1.UpperLeft.Pane.Height / RzSplitter1.Height) * RzSplitter1.Width);  //width
  h := Ceil((RzSplitter1.UpperLeft.Pane.Width / RzSplitter1.Width) * RzSplitter1.Height);  //height
  if RzSplitter1.Orientation = orHorizontal then
  begin
    RzSplitter1.Orientation := orVertical;
    RzSplitter1.UpperLeft.Pane.Height := h;
    RzSplitter1.Position := RzSplitter1.UpperLeft.Pane.Height;
    Button1.Caption := ‘Vertical (垂直铺设)‘;
  end
  else
  begin
    RzSplitter1.Orientation := orHorizontal;
    RzSplitter1.UpperLeft.Pane.Width := w;
    RzSplitter1.Position := RzSplitter1.UpperLeft.Pane.Width;
    Button1.Caption := ‘Horizontal (水平铺设)‘;
  end;

end;

  

  

Delphi 动态改变Rzsplitter的Orientation(方向)属性

上一篇:理论制作 Windows 开机动画


下一篇:百度地图Api进阶教程-创建标注和自定义标注3.html