zoukankan      html  css  js  c++  java
  • 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;
    

      

      

  • 相关阅读:
    音律入门
    [转]MIDI常识20条
    Java使用代理服务器
    java8日期时间
    误删课表系统
    Uncaught Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)
    SpringBoot应用部署[转]
    如何学习新技术
    Maven使用archetype迅速生成项目骨架
    两个月打工总结
  • 原文地址:https://www.cnblogs.com/go-jzg/p/4115530.html
Copyright © 2011-2022 走看看