support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
|
||||
|
||||
namespace HandyControl.Tools.Extension
|
||||
{
|
||||
/// <summary>
|
||||
/// 颜色扩展类
|
||||
/// </summary>
|
||||
public static class ColorExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 将颜色转换为10进制表示(rgb顺序颠倒)
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt32(this Color color) => color.R << 16 | color.G << 8 | color.B;
|
||||
|
||||
/// <summary>
|
||||
/// 将颜色转换为10进制表示(rgb顺序颠倒)
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt32Reverse(this Color color) => color.R | color.G << 8 | color.B << 18;
|
||||
|
||||
internal static List<byte> ToList(this Color color) => new List<byte>
|
||||
{
|
||||
color.R,
|
||||
color.G,
|
||||
color.B
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Tools.Extension
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class UIElementExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 显示元素
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public static void Show(this UIElement element)
|
||||
{
|
||||
element.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示元素
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <param name="show"></param>
|
||||
public static void Show(this UIElement element, bool show)
|
||||
{
|
||||
element.Visibility = show ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不现实元素,但保留空间
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public static void Hide(this UIElement element)
|
||||
{
|
||||
element.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不显示元素,且不保留空间
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public static void Collapse(this UIElement element)
|
||||
{
|
||||
element.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user