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


C# Point.Within方法代码示例

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


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

示例1: Main

      static void Main(string[] args)
      {
         Point p1 = new Point(3, 3);
         Point p2 = new Point(3, 1);
         Point p3 = new Point(2, 1);
         Point p4 = new Point(1, 1);

         //Console.WriteLine(p1.Distance(p2));
         //Console.WriteLine(p1.Distance(p3));
         //Console.WriteLine(p1.Distance(p4));

         p1.Within(2).ForEach(p =>
            Console.WriteLine(p));

         //RandomUntity ran = new RandomUntity();
         //ran.GetRandom(1, 100, 100).ToList().ForEach(i=>
         //   Console.Write(i + "\t"));

         //Console.WriteLine(BitOperator.GetBinaryCount(0x00042400));
      }
开发者ID:hubuUniversity,项目名称:demo,代码行数:20,代码来源:Program.cs

示例2: GetReorderingTargetDisplayIndex

        /// <summary>
        /// Returns the display index to set the column to
        /// </summary>
        /// <param name="mousePosition"></param>
        /// <param name="ignoreVertical"></param>
        /// <param name="clipToVisible"></param>
        /// <returns></returns>
        private int? GetReorderingTargetDisplayIndex(Point mousePosition, bool ignoreVertical, bool clipToVisible)
        {
            if (!clipToVisible || (mousePosition.Within(this, this.OwningGrid, ignoreVertical) && mousePosition.Within(this, this.OwningGrid.ColumnHeaders, ignoreVertical)))
            {
                DataGridColumnHeader result = this.OwningGrid.ColumnHeaders.Children
                    .OfType<DataGridColumnHeader>()
                    .Where(header => header.OwningGrid != null && header.OwningColumn != this.OwningGrid.ColumnsInternal.FillerColumn)
                    .OrderBy(header => header.OwningColumn.DisplayIndex)
                    .FirstOrDefault(header => IsReorderTargeted(mousePosition, header, ignoreVertical));

                if (result != null)
                {
                    if (result.OwningColumn.DisplayIndex > this.OwningColumn.DisplayIndex)
                    {
                        // later column, but we need to adjust for the index shift that would happen
                        return result.OwningColumn.DisplayIndex - 1;
                    }
                    else
                    {
                        // earlier column
                        return result.OwningColumn.DisplayIndex;
                    }
                }
                else
                {
                    // last column
                    return this.OwningGrid.Columns.Count - 1;
                }
            }

            return null;
        }
开发者ID:expanz,项目名称:expanz-Microsoft-XAML-SDKs,代码行数:39,代码来源:DataGridColumnHeader.xaml.cs

示例3: GetReorderingTargetColumn

        /// <summary>
        /// Returns the column against whose top-left the reordering caret should be positioned
        /// </summary>
        /// <param name="mousePosition"></param>
        /// <param name="ignoreVertical"></param>
        /// <param name="clipToVisible"></param>
        /// <returns></returns>
        private DataGridColumn GetReorderingTargetColumn(Point mousePosition, bool ignoreVertical, bool clipToVisible)
        {
            if (!clipToVisible || (mousePosition.Within(this, this.OwningGrid, ignoreVertical) && mousePosition.Within(this, this.OwningGrid.ColumnHeaders, ignoreVertical)))
            {
                DataGridColumnHeader result = this.OwningGrid.ColumnHeaders.Children
                    .OfType<DataGridColumnHeader>()
                    .Where(header => header.OwningGrid != null && header.OwningColumn != this.OwningGrid.ColumnsInternal.FillerColumn)
                    .OrderBy(header => header.OwningColumn.DisplayIndex)
                    .FirstOrDefault(header => IsReorderTargeted(mousePosition, header, ignoreVertical));

                if (result == null)
                {
                    return this.OwningGrid.ColumnsInternal.FillerColumn;
                }
                else
                {
                    return result.OwningColumn;
                }
            }

            return null;
        }
开发者ID:expanz,项目名称:expanz-Microsoft-XAML-SDKs,代码行数:29,代码来源:DataGridColumnHeader.xaml.cs


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