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


C# Padding.Equals方法代码示例

本文整理汇总了C#中System.Windows.Forms.Padding.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Padding.Equals方法的具体用法?C# Padding.Equals怎么用?C# Padding.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Padding的用法示例。


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

示例1: ApplyPadding

        /// <summary>
        /// Return the provided rectangle with visual orientation specific padding applied.
        /// </summary>
        /// <param name="orientation">Orientation to apply padding with.</param>
        /// <param name="rect">Starting rectangle.</param>
        /// <param name="padding">Padding to be applied.</param>
        /// <returns>Updated rectangle.</returns>
        public static Rectangle ApplyPadding(VisualOrientation orientation,
                                             Rectangle rect, 
                                             Padding padding)
        {
            // Ignore an empty padding value
            if (!padding.Equals(CommonHelper.InheritPadding))
            {
                // The orientation determines how the border padding is
                // used to reduce the space available for children
                switch (orientation)
                {
                    case VisualOrientation.Top:
                        rect = new Rectangle(rect.X + padding.Left, rect.Y + padding.Top,
                                             rect.Width - padding.Horizontal, rect.Height - padding.Vertical);
                        break;
                    case VisualOrientation.Bottom:
                        rect = new Rectangle(rect.X + padding.Right, rect.Y + padding.Bottom,
                                             rect.Width - padding.Horizontal, rect.Height - padding.Vertical);
                        break;
                    case VisualOrientation.Left:
                        rect = new Rectangle(rect.X + padding.Top, rect.Y + padding.Right,
                                             rect.Width - padding.Vertical, rect.Height - padding.Horizontal);
                        break;
                    case VisualOrientation.Right:
                        rect = new Rectangle(rect.X + padding.Bottom, rect.Y + padding.Left,
                                             rect.Width - padding.Vertical, rect.Height - padding.Horizontal);
                        break;
                    default:
                        // Should never happen!
                        Debug.Assert(false);
                        break;
                }
            }

            return rect;
        }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:43,代码来源:CommonHelper.cs

示例2: ApplyPadding

        private Rectangle ApplyPadding(Rectangle rect, Padding padding)
        {
            // Ignore an empty padding value
            if (!padding.Equals(CommonHelper.InheritPadding))
            {
                // Get the orientation to use for applying the padding
                VisualOrientation orientation = Orientation;

                // Do we need to apply right to left?
                if (_rightToLeftLayout && (_rightToLeft == RightToLeft.Yes))
                {
                    // Reverse the left and right only
                    switch (orientation)
                    {
                        case VisualOrientation.Left:
                            orientation = VisualOrientation.Right;
                            break;
                        case VisualOrientation.Right:
                            orientation = VisualOrientation.Left;
                            break;
                    }
                }

                // The orientation determines how the border padding is
                // used to reduce the space available for children
                switch (orientation)
                {
                    case VisualOrientation.Top:
                        rect = new Rectangle(rect.X + padding.Left, rect.Y + padding.Top,
                                             rect.Width - padding.Horizontal, rect.Height - padding.Vertical);
                        break;
                    case VisualOrientation.Bottom:
                        rect = new Rectangle(rect.X + padding.Left, rect.Y + padding.Bottom,
                                             rect.Width - padding.Horizontal, rect.Height - padding.Vertical);
                        break;
                    case VisualOrientation.Left:
                        rect = new Rectangle(rect.X + padding.Top, rect.Y + padding.Left,
                                             rect.Width - padding.Vertical, rect.Height - padding.Horizontal);
                        break;
                    case VisualOrientation.Right:
                        rect = new Rectangle(rect.X + padding.Bottom, rect.Y + padding.Left,
                                             rect.Width - padding.Vertical, rect.Height - padding.Horizontal);
                        break;
                    default:
                        // Should never happen!
                        Debug.Assert(false);
                        break;
                }
            }

            return rect;
        }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:52,代码来源:ViewLayoutViewport.cs

示例3: ApplyPadding

        public static Size ApplyPadding(Orientation orientation, Size size, Padding padding)
        {
            if (!padding.Equals(InheritPadding))
            {
                switch (orientation)
                {
                    case Orientation.Horizontal:
                        size.Width += padding.Horizontal;
                        size.Height += padding.Vertical;
                        return size;

                    case Orientation.Vertical:
                        size.Width += padding.Vertical;
                        size.Height += padding.Horizontal;
                        return size;
                }
            }
            return size;
        }
开发者ID:routd1,项目名称:ProjectHurricane,代码行数:19,代码来源:CommonHelper.cs


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