completed the branch
This commit is contained in:
1 parent
ff10e9ca26
commit
c529ceae56
24 files changed
+1978
-315
No files matched your search
@@ -36,9 +36,9 @@ namespace HandyControl.Tools
|
||||
/// <summary>
|
||||
/// 计算控件在窗口中的可见坐标
|
||||
/// </summary>
|
||||
public static Point CalSafePoint(FrameworkElement element, FrameworkElement showElement, Thickness thickness = default(Thickness))
|
||||
public static Point CalSafePoint(FrameworkElement element, FrameworkElement showElement, Thickness thickness = default)
|
||||
{
|
||||
if (element == null || showElement == null) return default(Point);
|
||||
if (element == null || showElement == null) return default;
|
||||
var point = element.PointToScreen(new Point(0, 0));
|
||||
|
||||
if (point.X < 0) point.X = 0;
|
||||
@@ -122,19 +122,6 @@ namespace HandyControl.Tools
|
||||
/// <returns></returns>
|
||||
public static double CalAngle(Point center, Point p) => Math.Atan2(p.Y - center.Y, p.X - center.X) * 180 / Math.PI;
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否是有效的双精度浮点数
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValidDoubleValue(object value)
|
||||
{
|
||||
var d = (double)value;
|
||||
if (!double.IsNaN(d))
|
||||
return !double.IsInfinity(d);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算法线
|
||||
/// </summary>
|
||||
|
||||
@@ -20,24 +20,88 @@
|
||||
/// 是否在正浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="includeZero"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDouble(object value, bool includeZero = false)
|
||||
public static bool IsInRangeOfPosDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v >= 0 : v > 0);
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正浮点数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDoubleIncludeZero(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="includeZero"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDouble(object value, bool includeZero = false)
|
||||
public static bool IsInRangeOfNegDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v <= 0 : v < 0);
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负浮点数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDoubleIncludeZero(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v <= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正整数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosInt(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正整数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosIntIncludeZero(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负整数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegInt(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在负整数范围内(包括0)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegIntIncludeZero(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v <= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace HandyControl.Tools
|
||||
if (result != null) return result;
|
||||
}
|
||||
|
||||
return default(T);
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user