zoukankan      html  css  js  c++  java
  • layout 的应用

    在XAF的开发中,详细Detail 或组合DashBoard页面,需要使用 LayoutControl 进行控件排列,下面讲述如何通过写代码进行操作。 

    0、DevExpress 的布局控件(DevExpress.XtraLayout) LayoutControl  有一个配置参数类 OptionsView 用于控制显示。

         用  LayoutControl.OptionsView    属性操作设置 settings (通过 OptionsView 类提供).  这些设置允许你能运行时 高亮 highlighting,  项目边线可见,控制外观等显示在 LayoutControl 内的东西。

    1、XAF 帮助手册的提示:操作 Layout Control

            用

     Layout Control  安排布局 View Items (来自 CompositeView.Items 集合)。

     

     

            依靠 Layout Control,为每个 View Item产生一个新的 Layout Item 。 Layout Item 设置允许你修改 caption, caption visibility and alignment等, 设置 Item size ,size 约束, indents and 外观appearance 设置等。

     

            另外,一个 Layout Item 含有 View Item's control (animation)。当然你不能描述这个 control 的尺寸, 锚定方式与位置。所有这些设置完全通过 Layout Item 进行管理。 你能设置 Layout Item's 尺寸size 为特定值 (用 BaseLayoutItem.Size 属性)。部分 Layout Item's 区域被 Item's caption, indents and borders 占用, 其它剩余区域由 Layout Item's control 占用。

     

      

     

         

     

            注意:一些 controls 不支持 resizing - 例如 text box or check box。所以,对含有这些controls的 Layout Item设置尺寸 将没有效果,因为 control 有固定尺寸,虽然事实是 Layout Item 允许重新设定尺寸。

            为了操纵 Layout Control 和它的 Layout Items,按下列步骤进行:

    • 创建一个 新 View Controller 在 WinForms 模块;
    • 调度 Designer 为新 Controller。因 Controller 必须被激活为 Dashboard Views 或者 Detail Views,设置 Controller 的 ViewController.TypeOfView 属性要求的 value(Dashboard 、Detail)。
    • 用 Properties 窗口,设置订购Subscribe 控制器 Controller.Activated 事件,
    • 代替自动生成的Activated 事件 handler ,用下列代码.

        private void LayoutController_Activated(object sender, EventArgs e)
    { View.ControlsCreated += new EventHandler(View_ControlsCreated); }

    • 因为目标是自定义 Layout Control,你需要创建后直接地操作它,。最好的方式是响应当前 View 的 View.ControlsCreated 事件.

    • 实现 View.ControlsCreated 事件处理, 如下: 
    void View_ControlsCreated(object sender, EventArgs e) {
       // 操纵当前 Detail View 
       DetailView view = (DetailView)View;
       // 操作 Detail View's Control 转型为 Layout Control 
       DevExpress.XtraLayout.LayoutControl layoutControl = 
          ((DevExpress.XtraLayout.LayoutControl)view.Control);
       //自定义 LayoutControl 的设置参数
       //操纵 Layout Control 的 Layout Items 
       foreach (object obj in layoutControl.Items) {
          if (obj is DevExpress.XtraLayout.LayoutControlItem) {
             DevExpress.XtraLayout.LayoutControlItem layoutControlItem = 
                (DevExpress.XtraLayout.LayoutControlItem)obj;
    //自定义 当前 LayoutItem's settings  } } }

    为编译上述代码,增加引用 DevExpress.XtraLayout.v16.1 assembly 在 WinForms 模块.
  • 相关阅读:
    reids(缓存,reids下载,安装 测试)
    springboot(运行原理参考借鉴)
    springboot(整合事务和分布式事务)
    springboot(整合多数据源demo,aop,定时任务,异步方法调用,以及获取properties中自定义的变量值)
    Docker报错 WARNING: IPv4 forwarding is disabled. Networking will not work.
    springboot整合netty,多种启动netty的方式,展现bean得多种启动方法
    im开发总结:netty的使用
    学习中常见错误码得解决方案
    内部类的使用
    Variable used in lambda expression should be final or effectively final
  • 原文地址:https://www.cnblogs.com/hopesun/p/7681363.html
Copyright © 2011-2022 走看看