当前位置: 首页>>代码示例>>C#>>正文


C# ILayoutElement类代码示例

本文整理汇总了C#中ILayoutElement的典型用法代码示例。如果您正苦于以下问题:C# ILayoutElement类的具体用法?C# ILayoutElement怎么用?C# ILayoutElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ILayoutElement类属于命名空间,在下文中一共展示了ILayoutElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LayoutFloatingWindowControl

 protected LayoutFloatingWindowControl(ILayoutElement model)
 {
     Loaded += OnLoaded;
     Unloaded += OnUnloaded;
     _model = model;
     UpdateThemeResources();
 }
开发者ID:x-skywalker,项目名称:CodeMask,代码行数:7,代码来源:LayoutFloatingWindowControl.cs

示例2: SizeLayoutElement

        private static void SizeLayoutElement(ILayoutElement layoutElement,
                                              float height,
                                              VerticalAlign verticalAlign,
                                              float restrictedHeight,
                                              float? width,
                                              bool variableColumnWidth,
                                              float columnWidth)
        {
            float? newHeight = null;

            // if verticalAlign is "justify" or "contentJustify", 
            // restrict the height to restrictedHeight.  Otherwise, 
            // size it normally
            if (verticalAlign == VerticalAlign.Justify ||
                verticalAlign == VerticalAlign.ContentJustify)
            {
                newHeight = restrictedHeight;
            }
            else
            {
                if (null != layoutElement.PercentHeight)
                    newHeight = CalculatePercentHeight(layoutElement, height);
            }

            if (variableColumnWidth)
                layoutElement.SetLayoutBoundsSize(width, newHeight);
            else
                layoutElement.SetLayoutBoundsSize(columnWidth, newHeight);
        }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:29,代码来源:HorizontalLayout.cs

示例3: CalculatePercentWidth

 private static float CalculatePercentWidth(ILayoutElement layoutElement, float width)
 {
     float percentWidth = Mathf.Clamp(Mathf.Round((float) (layoutElement.PercentWidth * 0.01f * width)),
                                      LayoutUtil.GetMinBoundsWidth((InvalidationManagerClient)layoutElement),
                                      LayoutUtil.GetMaxBoundsWidth((InvalidationManagerClient) layoutElement));
     return percentWidth < width ? percentWidth : width;
 }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:7,代码来源:VerticalLayout.cs

示例4: SizeLayoutElement

        private static void SizeLayoutElement(ILayoutElement layoutElement,
                                              float width,
                                              HorizontalAlign horizontalAlign,
                                              float restrictedWidth,
                                              float? height,
                                              bool variableRowHeight,
                                              float rowHeight)
        {
            float? newWidth = null;

            // if horizontalAlign is "justify" or "contentJustify", 
            // restrict the width to restrictedWidth.  Otherwise, 
            // size it normally
            if (horizontalAlign == HorizontalAlign.Justify ||
                horizontalAlign == HorizontalAlign.ContentJustify)
            {
                newWidth = restrictedWidth;
            }
            else
            {
                if (null != layoutElement.PercentWidth)
                    newWidth = CalculatePercentWidth(layoutElement, width);
            }

            if (variableRowHeight)
                layoutElement.SetLayoutBoundsSize(newWidth, height);
            else
                layoutElement.SetLayoutBoundsSize(newWidth, rowHeight);
        }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:29,代码来源:VerticalLayout.cs

示例5: CalculatePercentHeight

 private static float CalculatePercentHeight(ILayoutElement layoutElement, float height)
 {
     float percentHeight = Mathf.Clamp(Mathf.Round((float)(layoutElement.PercentHeight * 0.01f * height)),
                                      LayoutUtil.GetMinBoundsHeight((InvalidationManagerClient)layoutElement),
                                      LayoutUtil.GetMaxBoundsHeight((InvalidationManagerClient)layoutElement));
     return percentHeight < height ? percentHeight : height;
 }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:7,代码来源:HorizontalLayout.cs

示例6: LayoutFloatingWindowControl

 protected LayoutFloatingWindowControl(ILayoutElement model)
 {
     this.Loaded += new RoutedEventHandler(OnLoaded);
     this.Unloaded += new RoutedEventHandler(OnUnloaded);
     _model = model;
     UpdateThemeResources();
 }
开发者ID:qjw2bqn,项目名称:Esri-Geometry-Network-Configuration-Manager,代码行数:7,代码来源:LayoutFloatingWindowControl.cs

示例7: GetLastFocusedElement

        /// <summary>
        /// Get the input element that was focused before user left the layout element
        /// </summary>
        /// <param name="model">Element to look for</param>
        /// <returns>Input element </returns>
        internal static IInputElement GetLastFocusedElement(ILayoutElement model)
        {
            IInputElement objectWithFocus;
            if (_modelFocusedElement.GetValue(model, out objectWithFocus))
                return objectWithFocus;

            return null;
        }
开发者ID:qjw2bqn,项目名称:Esri-Geometry-Network-Configuration-Manager,代码行数:13,代码来源:FocusElementManager.cs

示例8: ShowProp

 private void ShowProp(ref Rect labelRect, ref Rect valueRect, ref Rect sourceRect, string label, string value, ILayoutElement source)
 {
   GUI.Label(labelRect, label, this.m_Styles.labelStyle);
   GUI.Label(valueRect, value, this.m_Styles.labelStyle);
   GUI.Label(sourceRect, source != null ? source.GetType().Name : "none", this.m_Styles.labelStyle);
   labelRect.y += EditorGUIUtility.singleLineHeight;
   valueRect.y += EditorGUIUtility.singleLineHeight;
   sourceRect.y += EditorGUIUtility.singleLineHeight;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:9,代码来源:LayoutPropertiesPreview.cs

示例9: ConvertLayoutElement

 BaseInfo ConvertLayoutElement(ILayoutElement e)
 {
     if (e is LayoutPanel)
     {
         var panel = e as LayoutPanel;
         var sp = new LayoutPanelInfo
         {
             Width = new GridLengthInfo {Unit = panel.DockWidth.GridUnitType, Value = panel.DockWidth.Value},
             Height = new GridLengthInfo {Unit = panel.DockHeight.GridUnitType, Value = panel.DockHeight.Value}
         };
         foreach (var x in panel.Children)
         {
             sp.Children.Add(ConvertLayoutElement(x));
         }
         return sp;
     }
     else if (e is LayoutRoot)
     {
         var root = e as LayoutRoot;
         var sp = new LayoutRootInfo {Center = (LayoutPanelInfo) ConvertLayoutElement(root.RootPanel)};
         return sp;
     }
     else if (e is LayoutDocumentPane)
     {
         var doc = e as LayoutDocumentPane;
         var sp = new DocumentPaneInfo
         {
             Width = new GridLengthInfo {Unit = doc.DockWidth.GridUnitType, Value = doc.DockWidth.Value},
             Height = new GridLengthInfo {Unit = doc.DockHeight.GridUnitType, Value = doc.DockHeight.Value}
         };
         sp.Content.AddRange(ConvertViews(doc.Children));
         return sp;
     }
     else if (e is LayoutDocumentPaneGroup)
     {
         var doc = e as LayoutDocumentPaneGroup;
         var sp = new LayoutDocumentPaneGroupInfo
         {
             Width = new GridLengthInfo {Unit = doc.DockWidth.GridUnitType, Value = doc.DockWidth.Value},
             Height = new GridLengthInfo {Unit = doc.DockHeight.GridUnitType, Value = doc.DockHeight.Value},
             Orientation = doc.Orientation
         };
         foreach (var x in doc.Children)
         {
             sp.Children.Add(ConvertLayoutElement(x));
         }
         return sp;
     }
     else
         throw new NotSupportedException();
 }
开发者ID:chienhao10,项目名称:FinalesFunkeln,代码行数:51,代码来源:WindowInfo.cs

示例10: GetLayoutProperty

        public static float GetLayoutProperty(RectTransform rect, System.Func<ILayoutElement, float> property, float defaultValue, out ILayoutElement source)
        {
            source = null;
            if (rect == null)
                return 0;
            float min = defaultValue;
            int maxPriority = System.Int32.MinValue;
            var components = ComponentListPool.Get();
            rect.GetComponents(typeof(ILayoutElement), components);

            for (int i = 0; i < components.Count; i++)
            {
                var layoutComp = components[i] as ILayoutElement;
                if (layoutComp is Behaviour && !(layoutComp as Behaviour).enabled)
                    continue;

                int priority = layoutComp.layoutPriority;
                // If this layout components has lower priority than a previously used, ignore it.
                if (priority < maxPriority)
                    continue;
                float prop = property(layoutComp);
                // If this layout property is set to a negative value, it means it should be ignored.
                if (prop < 0)
                    continue;

                // If this layout component has higher priority than all previous ones,
                // overwrite with this one's value.
                if (priority > maxPriority)
                {
                    min = prop;
                    maxPriority = priority;
                    source = layoutComp;
                }
                // If the layout component has the same priority as a previously used,
                // use the largest of the values with the same priority.
                else if (prop > min)
                {
                    min = prop;
                    source = layoutComp;
                }
            }

            ComponentListPool.Release(components);
            return min;
        }
开发者ID:aammfe,项目名称:unity3d-ui,代码行数:45,代码来源:LayoutUtility.cs

示例11: CalculateElementWidth

 /**
  *  
  * 
  *  Used only for virtual layout.
  */
 private float? CalculateElementWidth(ILayoutElement elt, float targetWidth, float containerWidth)
 {
    // If percentWidth is specified then the element's width is the percentage
    // of targetWidth clipped to min/maxWidth and to (upper limit) targetWidth.
    float? percentWidth = elt.PercentWidth;
    if (null != percentWidth)
    {
       float width = (float) (percentWidth * 0.01f * targetWidth);
       return Mathf.Min(targetWidth, Mathf.Min(
           LayoutUtil.GetMaxBoundsWidth((InvalidationManagerClient) elt), 
           Mathf.Max(LayoutUtil.GetMinBoundsWidth((InvalidationManagerClient)elt), 
           width
         )));
    }
    switch(_horizontalAlign)
    {
        case HorizontalAlign.Justify: 
            return targetWidth;
        case HorizontalAlign.ContentJustify:
            return Mathf.Max(LayoutUtil.GetPreferredBoundsWidth((InvalidationManagerClient) elt), containerWidth);
    }
    return null;  // not constrained
 }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:28,代码来源:VerticalLayout.cs

示例12: ReplaceChild

 public abstract void ReplaceChild(ILayoutElement oldElement, ILayoutElement newElement);
开发者ID:vebin,项目名称:ModernApplicationFramework,代码行数:1,代码来源:LayoutFloatingWindow.cs

示例13: RemoveChild

 public abstract void RemoveChild(ILayoutElement element);
开发者ID:vebin,项目名称:ModernApplicationFramework,代码行数:1,代码来源:LayoutFloatingWindow.cs

示例14: GetLayoutProperty

 public static float GetLayoutProperty(RectTransform rect, Func<ILayoutElement, float> property, float defaultValue, out ILayoutElement source)
 {
   source = (ILayoutElement) null;
   if ((UnityEngine.Object) rect == (UnityEngine.Object) null)
     return 0.0f;
   float num1 = defaultValue;
   int num2 = int.MinValue;
   List<Component> componentList = ListPool<Component>.Get();
   rect.GetComponents(typeof (ILayoutElement), componentList);
   for (int index = 0; index < componentList.Count; ++index)
   {
     ILayoutElement layoutElement = componentList[index] as ILayoutElement;
     if (!(layoutElement is Behaviour) || ((Behaviour) layoutElement).isActiveAndEnabled)
     {
       int layoutPriority = layoutElement.layoutPriority;
       if (layoutPriority >= num2)
       {
         float num3 = property(layoutElement);
         if ((double) num3 >= 0.0)
         {
           if (layoutPriority > num2)
           {
             num1 = num3;
             num2 = layoutPriority;
             source = layoutElement;
           }
           else if ((double) num3 > (double) num1)
           {
             num1 = num3;
             source = layoutElement;
           }
         }
       }
     }
   }
   ListPool<Component>.Release(componentList);
   return num1;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:38,代码来源:LayoutUtility.cs

示例15: SetFocusOnLastElement

        /// <summary>
        /// Given a layout element tries to set the focus of the keyword where it was before user moved to another element
        /// </summary>
        /// <param name="model"></param>
        internal static void SetFocusOnLastElement(ILayoutElement model)
        {
            bool focused = false;
            IInputElement objectToFocus;
            if (_modelFocusedElement.GetValue(model, out objectToFocus))
            {
                focused = objectToFocus == Keyboard.Focus(objectToFocus);
            }

            IntPtr handleToFocus;
            if (_modelFocusedWindowHandle.GetValue(model, out handleToFocus))
                focused = IntPtr.Zero != Win32Helper.SetFocus(handleToFocus);


            if (focused)
            {
                _lastFocusedElement = new WeakReference(model);
            }

        }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:24,代码来源:FocusElementManager.cs


注:本文中的ILayoutElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。