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


C# Frame.GetPaddedRectangle方法代码示例

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


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

示例1: RunLayout

        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetFrame"></param>
        /// <param name="forceTransitions"></param>
        public override void RunLayout( Frame targetFrame, bool forceTransitions = false )
        {
            int offset = Offset;
            var gp = targetFrame.GetPaddedRectangle(false);

            foreach ( var child in targetFrame.Children ) {

                child.X = gp.X;
                child.Y = gp.Y + offset;

                offset += child.Height;
                offset += Interval;

            }
        }
开发者ID:temik911,项目名称:audio,代码行数:20,代码来源:StackLayout.cs

示例2: RunLayout

        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetFrame"></param>
        public override void RunLayout( Frame targetFrame, bool forceTransitions = false )
        {
            var gp	=	targetFrame.GetPaddedRectangle();
            int w1	=	( gp.Width	- gapW ) / 2;
            int h1	=	( gp.Height	- gapH ) / 2;
            int w2	=	w1 + ( MathUtil.IsOdd( gp.Width - gapW ) ? 1 : 0 );
            int h2	=	h1 + ( MathUtil.IsOdd( gp.Height - gapH )  ? 1 : 0 );

            bool	useTransitions	=	!forceTransitions & UseTransitions;

            //targetFrame.ForEachChildren( f => f.Visible = false );

            if ( LayoutStyle==QuadLayoutStyle.SinglePanel ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  2, 2 );
                HideFrame( targetFrame, useTransitions, 1 );
                HideFrame( targetFrame, useTransitions, 2 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.TwoPanelsSideBySide ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  1, 2 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  1, 0,  1, 2 );
                HideFrame( targetFrame, useTransitions, 2 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.TwoPanelsStacked ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  2, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  0, 1,  2, 1 );
                HideFrame( targetFrame, useTransitions, 2 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitLeft ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  0, 1,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 2,  1, 0,  1, 2 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitRight ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  1, 2 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  1, 0,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 2,  1, 1,  1, 1 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitTop ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  1, 0,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 2,  0, 1,  2, 1 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitBottom ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  2, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  0, 1,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 2,  1, 1,  1, 1 );
                HideFrame( targetFrame, useTransitions, 3 );
                return;
            }

            if ( LayoutStyle==QuadLayoutStyle.FourPanels ) {
                MoveAndResizeLogical( targetFrame, useTransitions, 0,  0, 0,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 1,  0, 1,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 2,  1, 0,  1, 1 );
                MoveAndResizeLogical( targetFrame, useTransitions, 3,  1, 1,  1, 1 );
                return;
            }
        }
开发者ID:temik911,项目名称:audio,代码行数:80,代码来源:QuadLayout.cs

示例3: MoveAndResizeLogical

        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetFrame"></param>
        /// <param name="childIndex"></param>
        /// <param name="logicalX"></param>
        /// <param name="logicalY"></param>
        /// <param name="logicalWidth"></param>
        /// <param name="logicalHeight"></param>
        void MoveAndResizeLogical( Frame targetFrame, bool useTransitions, int childIndex, int logicalX, int logicalY, int logicalWidth, int logicalHeight )
        {
            int offsetX = 0;
            int offsetY = 0;

            if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitRight) {
                offsetX = (int)((targetFrame.Width - gapW)/2 * 0.2f);
                offsetY = (int)((targetFrame.Width - gapW)/2 * 0.1f);
            }
            if (logicalWidth==2) offsetX = 0;
            if (logicalHeight==2) offsetY = 0;

            var gp	=	targetFrame.GetPaddedRectangle(false);
            int w1	=	( gp.Width	- gapW ) / 2;
            int h1	=	( gp.Height	- gapH ) / 2;

            int x	=	gp.X + logicalX * ( w1 + gapW ) + ( offsetX * ((logicalX==0) ? 0 : 1) );
            int y	=	gp.Y + logicalY * ( h1 + gapH ) + ( offsetY * ((logicalY==0) ? 0 : 1) );
            int w	=	w1 * logicalWidth  + gapW * (logicalWidth  - 1) + ( offsetX * ((logicalX==0) ? 1 : -1) );
            int h	=	h1 * logicalHeight + gapH * (logicalHeight - 1) + ( offsetY * ((logicalY==0) ? 1 : -1) );

            MoveAndResize( targetFrame, useTransitions, childIndex, x, y, w, h );
        }
开发者ID:temik911,项目名称:audio,代码行数:32,代码来源:QuadLayout.cs

示例4: HideFrame

        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetFrame"></param>
        /// <param name="useTransitions"></param>
        /// <param name="childIndex"></param>
        void HideFrame( Frame targetFrame, bool useTransitions, int childIndex )
        {
            var child = targetFrame.Children.ElementAtOrDefault( childIndex );

            if (child==null) {
                return;
            }

            var color =	new Color(255,255,255,0);

            var gp	=	targetFrame.GetPaddedRectangle(false);
            int w	=	( gp.Width	- gapW ) / 2;
            int h	=	( gp.Height	- gapH ) / 2;
            int x	=	w / 2;
            int y	=	h / 2;

            if (useTransitions) {
                child.RunTransition("OverallColor", color,		0*(childIndex+1) * TransitionDelay, TransitionPeriod );
                //child.RunTransition("X",			x,			0*(childIndex+1) * TransitionDelay, TransitionPeriod );
                //child.RunTransition("Y",			y,			0*(childIndex+1) * TransitionDelay, TransitionPeriod );
                //child.RunTransition("Width",		w,			0*(childIndex+1) * TransitionDelay, TransitionPeriod );
                //child.RunTransition("Height",		h,			0*(childIndex+1) * TransitionDelay, TransitionPeriod );
            } else {
                child.OverallColor	=	color;
                //child.X			=	x;
                //child.Y			=	y;
                //child.Width		=	w;
                //child.Height	=	h;
            }
        }
开发者ID:temik911,项目名称:audio,代码行数:36,代码来源:QuadLayout.cs


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