码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2014-11-22 20:12:37      阅读:371      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   os   sp   for   on   

效果图:

bubuko.com,布布扣

原先不知道,弄了半天都改不了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(方向)属性

标签:style   blog   http   io   ar   os   sp   for   on   

原文地址:http://www.cnblogs.com/go-jzg/p/4115530.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!