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


C# IBlock.CopyTo方法代码示例

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


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

示例1: Layout

		/// <summary>
		/// Performs layout of the content block.
		/// </summary>
		/// <param name="containerBounds">Container bounds to layout content blocks in.</param>
		/// <param name="contentBlocks">Content blocks to layout.</param>
		/// <param name="blockLayout">Block layout manager that resizes the content blocks.</param>
		/// <returns>The bounds of the content blocks within the container bounds.</returns>
		public override Rectangle Layout(Rectangle containerBounds,IBlock[] contentBlocks,BlockLayoutManager blockLayout)
		{
			if(contentBlocks.Length==0)
				return Rectangle.Empty;

			if(m_MouseOverIndex==-1)
			{
				return base.Layout(containerBounds,contentBlocks,blockLayout);
			}

			BubbleButton[] buttons=new BubbleButton[contentBlocks.Length];
			contentBlocks.CopyTo(buttons,0);

			int x=0,y=0;
			if(this.ContentOrientation==eContentOrientation.Horizontal)
			{
				buttons[m_MouseOverIndex].SetMagnifiedDisplayRectangle(new Rectangle(m_MouseOverPosition,GetY(containerBounds,m_BubbleSize.Height),m_BubbleSize.Width,m_BubbleSize.Height));
				x=m_MouseOverPosition;
			}
			else
			{
				buttons[m_MouseOverIndex].SetMagnifiedDisplayRectangle(new Rectangle(GetX(containerBounds,m_BubbleSize.Width),m_MouseOverPosition,m_BubbleSize.Width,m_BubbleSize.Height));
				y=m_MouseOverPosition;
			}

			int growthWidth=m_BubbleSize.Width-contentBlocks[0].Bounds.Width;
			int growthHeight=m_BubbleSize.Height-contentBlocks[0].Bounds.Height;

			// Apply factor 2
			int index=GetPreviousButtonIndex(buttons,m_MouseOverIndex);
			if(index>=0)
				SetFactorPrevious(containerBounds,buttons[index],growthWidth,growthHeight,m_Factor2,ref x, ref y);
			
			// Apply factor 1
			index=GetPreviousButtonIndex(buttons,index);
			if(index>=0)
				SetFactorPrevious(containerBounds,buttons[index],growthWidth,growthHeight,m_Factor1,ref x, ref y);

			if(this.ContentOrientation==eContentOrientation.Horizontal)
			{
				while(index>=0)
				{
					index=GetPreviousButtonIndex(buttons,index);
					if(index>=0)
					{
						x-=(buttons[index].DisplayRectangle.Width+this.BlockSpacing);
						buttons[index].SetMagnifiedDisplayRectangle(new Rectangle(x,buttons[index].DisplayRectangle.Y,buttons[index].DisplayRectangle.Width,buttons[index].DisplayRectangle.Height));	
					}
				}
				x=m_MouseOverPosition+m_BubbleSize.Width+this.BlockSpacing;
			}
			else
			{
				while(index>=0)
				{
					index=GetPreviousButtonIndex(buttons,index);
					if(index>=0)
					{
						y-=(buttons[index].DisplayRectangle.Height+this.BlockSpacing);
						buttons[index].SetMagnifiedDisplayRectangle(new Rectangle(buttons[index].DisplayRectangle.X,y,buttons[index].DisplayRectangle.Width,buttons[index].DisplayRectangle.Height));
					}
				}

				y=m_MouseOverPosition+m_BubbleSize.Height+this.BlockSpacing;
			}
			
			// Apply factor 3
			index=GetNextButtonIndex(buttons,m_MouseOverIndex);
			if(index>=0)
				SetFactorNext(containerBounds,buttons[index],growthWidth,growthHeight,m_Factor3,ref x, ref y);

			// Apply factor 4
			if(index==-1) index=m_MouseOverIndex;
			index=GetNextButtonIndex(buttons,index);
			if(index>=0)
				SetFactorNext(containerBounds,buttons[index],growthWidth,growthHeight,m_Factor4,ref x, ref y);
			
			if(this.ContentOrientation==eContentOrientation.Horizontal)
			{
				while(index>=0)
				{
					index=GetNextButtonIndex(buttons,index);
					if(index>=0)
					{
						buttons[index].SetMagnifiedDisplayRectangle(new Rectangle(x,buttons[index].DisplayRectangle.Y,buttons[index].DisplayRectangle.Width,buttons[index].DisplayRectangle.Height));
						x+=(buttons[index].DisplayRectangle.Width+this.BlockSpacing);
					}
				}
			}
			else
			{
				while(index>=0)
				{
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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