本文整理汇总了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));
}
示例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;
}
示例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;
}