* 增加XML文档文件
This commit is contained in:
parent
6509d0b251
commit
cab4b45ad7
@ -31,9 +31,19 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 形状
|
||||
/// </summary>
|
||||
public enum UIShape
|
||||
{
|
||||
/// <summary>
|
||||
/// 圆形
|
||||
/// </summary>
|
||||
Circle,
|
||||
|
||||
/// <summary>
|
||||
/// 方形
|
||||
/// </summary>
|
||||
Square
|
||||
}
|
||||
|
||||
@ -54,7 +64,7 @@ namespace Sunny.UI
|
||||
/// All Files|*.*
|
||||
/// ------
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>图片过滤字符串</returns>
|
||||
public static string GetImageFilter()
|
||||
{
|
||||
StringBuilder allImageExtensions = new StringBuilder();
|
||||
@ -84,6 +94,11 @@ namespace Sunny.UI
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据文件名利用内存流生成图片,加载后文件不占用
|
||||
/// </summary>
|
||||
/// <param name="path">文件名</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Image FromFile(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
@ -104,6 +119,12 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置图片不透明度
|
||||
/// </summary>
|
||||
/// <param name="img">图片</param>
|
||||
/// <param name="opacity">不透明度</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Bitmap ChangeOpacity(Image img, float opacity)
|
||||
{
|
||||
Bitmap bmp = new Bitmap(img.Width, img.Height); // Determining Width and Height of Source Image
|
||||
@ -117,7 +138,14 @@ namespace Sunny.UI
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public static ImageList GetToolbarImageList(Type type, Image bitmap, Size imageSize, Color transparentColor)
|
||||
/// <summary>
|
||||
/// 获取工具栏图片列表
|
||||
/// </summary>
|
||||
/// <param name="bitmap">图片</param>
|
||||
/// <param name="imageSize">单图大小</param>
|
||||
/// <param name="transparentColor">透明度</param>
|
||||
/// <returns>图片列表</returns>
|
||||
public static ImageList GetToolbarImageList(Image bitmap, Size imageSize, Color transparentColor)
|
||||
{
|
||||
ImageList imageList = new ImageList();
|
||||
imageList.ImageSize = imageSize;
|
||||
@ -127,6 +155,13 @@ namespace Sunny.UI
|
||||
return imageList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片截取
|
||||
/// </summary>
|
||||
/// <param name="image">图片</param>
|
||||
/// <param name="size">大小</param>
|
||||
/// <param name="shape">形状</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Bitmap Split(this Image image, int size, UIShape shape)
|
||||
{
|
||||
//截图画板
|
||||
@ -158,6 +193,12 @@ namespace Sunny.UI
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片截取
|
||||
/// </summary>
|
||||
/// <param name="image">图片</param>
|
||||
/// <param name="path">路径</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Bitmap Split(this Image image, GraphicsPath path)
|
||||
{
|
||||
//截图画板
|
||||
@ -175,6 +216,11 @@ namespace Sunny.UI
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片的绘图图元
|
||||
/// </summary>
|
||||
/// <param name="image">图片</param>
|
||||
/// <returns>绘图图元</returns>
|
||||
public static Graphics Graphics(this Image image)
|
||||
{
|
||||
return System.Drawing.Graphics.FromImage(image);
|
||||
@ -183,8 +229,8 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 图像水平翻转
|
||||
/// </summary>
|
||||
/// <param name="image">原来图像</param>
|
||||
/// <returns></returns>
|
||||
/// <param name="image">原图像</param>
|
||||
/// <returns>图像</returns>
|
||||
public static Bitmap HorizontalFlip(this Bitmap image)
|
||||
{
|
||||
try
|
||||
@ -206,8 +252,8 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 图像垂直翻转
|
||||
/// </summary>
|
||||
/// <param name="image">原来图像</param>
|
||||
/// <returns></returns>
|
||||
/// <param name="image">原图像</param>
|
||||
/// <returns>图像</returns>
|
||||
public static Bitmap VerticalFlip(this Bitmap image)
|
||||
{
|
||||
try
|
||||
@ -575,6 +621,12 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Base64数据绘图
|
||||
/// </summary>
|
||||
/// <param name="g">绘图图元</param>
|
||||
/// <param name="base64Image">Base64</param>
|
||||
/// <param name="rect">区域</param>
|
||||
public static void DrawImageFromBase64(this Graphics g, string base64Image, Rectangle rect)
|
||||
{
|
||||
using (var ms = new System.IO.MemoryStream(Convert.FromBase64String(base64Image)))
|
||||
@ -585,6 +637,13 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制透明图片
|
||||
/// </summary>
|
||||
/// <param name="g">绘图图元</param>
|
||||
/// <param name="alpha">透明度</param>
|
||||
/// <param name="image">图片</param>
|
||||
/// <param name="rect">区域</param>
|
||||
public static void DrawTransparentImage(this Graphics g, float alpha, Image image, Rectangle rect)
|
||||
{
|
||||
var colorMatrix = new ColorMatrix { Matrix33 = alpha };
|
||||
@ -594,6 +653,14 @@ namespace Sunny.UI
|
||||
imageAttributes.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="rect"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <param name="strokeColor"></param>
|
||||
/// <param name="strokeThickness"></param>
|
||||
public static void DrawStrokedRectangle(this Graphics g, Rectangle rect, Color bodyColor, Color strokeColor, int strokeThickness = 1)
|
||||
{
|
||||
using (var bodyBrush = new SolidBrush(bodyColor))
|
||||
@ -611,6 +678,14 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="rect"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <param name="strokeColor"></param>
|
||||
/// <param name="strokeThickness"></param>
|
||||
public static void DrawStrokedEllipse(this Graphics g, Rectangle rect, Color bodyColor, Color strokeColor, int strokeThickness = 1)
|
||||
{
|
||||
using (var bodyBrush = new SolidBrush(bodyColor))
|
||||
@ -628,6 +703,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片转Baase64字符串
|
||||
/// </summary>
|
||||
/// <param name="image">图片</param>
|
||||
/// <returns>字符串</returns>
|
||||
public static string ToBase64(this Image image)
|
||||
{
|
||||
using (var toBase64 = new MemoryStream())
|
||||
@ -638,6 +718,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base64字符串转图片
|
||||
/// </summary>
|
||||
/// <param name="base64Image">字符串</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Image ToImage(string base64Image)
|
||||
{
|
||||
using (var toImage = new System.IO.MemoryStream(Convert.FromBase64String(base64Image)))
|
||||
@ -646,6 +731,12 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片存为图标
|
||||
/// </summary>
|
||||
/// <param name="img">图片</param>
|
||||
/// <param name="size">大小</param>
|
||||
/// <returns>图标</returns>
|
||||
public static Icon SaveToIcon(this Image img, int size = 16)
|
||||
{
|
||||
byte[] pngiconheader = new byte[] { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
@ -28,8 +28,17 @@ using System.Web.Script.Serialization;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Json扩展类
|
||||
/// </summary>
|
||||
public static class Json
|
||||
{
|
||||
/// <summary>
|
||||
/// 反序列化字符串为对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T">对象类型</typeparam>
|
||||
/// <param name="input">字符串</param>
|
||||
/// <returns>对象</returns>
|
||||
public static T Deserialize<T>(string input)
|
||||
{
|
||||
try
|
||||
@ -48,6 +57,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序列号对象为字符串
|
||||
/// </summary>
|
||||
/// <param name="obj">对象</param>
|
||||
/// <returns>字符串</returns>
|
||||
public static string Serialize(object obj)
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
@ -58,12 +72,26 @@ namespace Sunny.UI
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从文件读取字符串反序列化为对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T">对象类型</typeparam>
|
||||
/// <param name="filename">文件名</param>
|
||||
/// <param name="encoding">文件编码</param>
|
||||
/// <returns>对象</returns>
|
||||
public static T DeserializeFromFile<T>(string filename, Encoding encoding)
|
||||
{
|
||||
string jsonStr = File.ReadAllText(filename, encoding);
|
||||
return Deserialize<T>(jsonStr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序列号对象为字符串并保存到文件
|
||||
/// </summary>
|
||||
/// <param name="obj">对象</param>
|
||||
/// <param name="filename">文件名</param>
|
||||
/// <param name="encoding">文件编码</param>
|
||||
/// <returns>字符串</returns>
|
||||
public static string SerializeToFile(object obj, string filename, Encoding encoding)
|
||||
{
|
||||
string jsonStr = Serialize(obj);
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 多语言字符串定义
|
||||
/// </summary>
|
||||
public static class UILocalize
|
||||
{
|
||||
/// <summary>
|
||||
@ -94,37 +97,135 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
public static string SystemProcessing = "系统正在处理中,请稍候...";
|
||||
|
||||
/// <summary>
|
||||
/// 星期一
|
||||
/// </summary>
|
||||
public static string Monday = "一";
|
||||
|
||||
/// <summary>
|
||||
/// 星期二
|
||||
/// </summary>
|
||||
public static string Tuesday = "二";
|
||||
|
||||
/// <summary>
|
||||
/// 星期三
|
||||
/// </summary>
|
||||
public static string Wednesday = "三";
|
||||
|
||||
/// <summary>
|
||||
/// 星期四
|
||||
/// </summary>
|
||||
public static string Thursday = "四";
|
||||
|
||||
/// <summary>
|
||||
/// 星期五
|
||||
/// </summary>
|
||||
public static string Friday = "五";
|
||||
|
||||
/// <summary>
|
||||
/// 星期六
|
||||
/// </summary>
|
||||
public static string Saturday = "六";
|
||||
|
||||
/// <summary>
|
||||
/// 星期日
|
||||
/// </summary>
|
||||
public static string Sunday = "日";
|
||||
|
||||
/// <summary>
|
||||
/// 上一页
|
||||
/// </summary>
|
||||
public static string Prev = "上一页";
|
||||
|
||||
/// <summary>
|
||||
/// 下一页
|
||||
/// </summary>
|
||||
public static string Next = "下一页";
|
||||
|
||||
/// <summary>
|
||||
/// 第
|
||||
/// </summary>
|
||||
public static string SelectPageLeft = "第";
|
||||
|
||||
/// <summary>
|
||||
/// 页
|
||||
/// </summary>
|
||||
public static string SelectPageRight = "页";
|
||||
|
||||
/// <summary>
|
||||
/// 一月
|
||||
/// </summary>
|
||||
public static string January = "一月";
|
||||
|
||||
/// <summary>
|
||||
/// 二月
|
||||
/// </summary>
|
||||
public static string February = "二月";
|
||||
|
||||
/// <summary>
|
||||
/// 三月
|
||||
/// </summary>
|
||||
public static string March = "三月";
|
||||
|
||||
/// <summary>
|
||||
/// 四月
|
||||
/// </summary>
|
||||
public static string April = "四月";
|
||||
|
||||
/// <summary>
|
||||
/// 五月
|
||||
/// </summary>
|
||||
public static string May = "五月";
|
||||
|
||||
/// <summary>
|
||||
/// 六月
|
||||
/// </summary>
|
||||
public static string June = "六月";
|
||||
|
||||
/// <summary>
|
||||
/// 七月
|
||||
/// </summary>
|
||||
public static string July = "七月";
|
||||
|
||||
/// <summary>
|
||||
/// 八月
|
||||
/// </summary>
|
||||
public static string August = "八月";
|
||||
|
||||
/// <summary>
|
||||
/// 九月
|
||||
/// </summary>
|
||||
public static string September = "九月";
|
||||
|
||||
/// <summary>
|
||||
/// 十月
|
||||
/// </summary>
|
||||
public static string October = "十月";
|
||||
|
||||
/// <summary>
|
||||
/// 十一月
|
||||
/// </summary>
|
||||
public static string November = "十一月";
|
||||
|
||||
/// <summary>
|
||||
/// 十二月
|
||||
/// </summary>
|
||||
public static string December = "十二月";
|
||||
|
||||
/// <summary>
|
||||
/// 今天
|
||||
/// </summary>
|
||||
public static string Today = "今天";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多语言字符串帮助类
|
||||
/// </summary>
|
||||
public static class UILocalizeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置为英文
|
||||
/// </summary>
|
||||
public static void SetEN()
|
||||
{
|
||||
UILocalize.InfoTitle = "Info";
|
||||
@ -173,6 +274,9 @@ namespace Sunny.UI
|
||||
UIStyles.Translate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置为中文
|
||||
/// </summary>
|
||||
public static void SetCH()
|
||||
{
|
||||
UILocalize.InfoTitle = "提示";
|
||||
|
@ -67,11 +67,27 @@ using System.Threading;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 多进程通信类
|
||||
/// </summary>
|
||||
public sealed class MMFile : BackgroundWorkerEx, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存文件名
|
||||
/// </summary>
|
||||
public string MapName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 大小
|
||||
/// </summary>
|
||||
public int Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="mapName">内存文件名</param>
|
||||
/// <param name="capacity">大小</param>
|
||||
/// <exception cref="Exception">报错消息</exception>
|
||||
public MMFile(string mapName, int capacity = 4096)
|
||||
{
|
||||
if (!FileEx.IsValidFileName(mapName))
|
||||
@ -91,8 +107,14 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息回调
|
||||
/// </summary>
|
||||
public event MMFileEventHandler OnMessage;
|
||||
|
||||
/// <summary>
|
||||
/// 线程运行
|
||||
/// </summary>
|
||||
protected override void DoWorker()
|
||||
{
|
||||
try
|
||||
@ -109,6 +131,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给目标内存文件写字符串
|
||||
/// </summary>
|
||||
/// <param name="dest">目标内存文件名</param>
|
||||
/// <param name="message">消息字符串</param>
|
||||
public void Write(string dest, string message)
|
||||
{
|
||||
var mmf = MemoryMappedFile.CreateOrOpen(dest, Capacity, MemoryMappedFileAccess.ReadWrite);
|
||||
@ -184,18 +211,42 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 析构函数
|
||||
/// </summary>
|
||||
~MMFile()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回调事件定义
|
||||
/// </summary>
|
||||
/// <param name="sender">对象</param>
|
||||
/// <param name="e">事件</param>
|
||||
public delegate void MMFileEventHandler(object sender, MMFileEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// 内存文件事件
|
||||
/// </summary>
|
||||
public class MMFileEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息来源
|
||||
/// </summary>
|
||||
public string Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息字符串
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="source">消息来源</param>
|
||||
/// <param name="value">消息字符串</param>
|
||||
public MMFileEventArgs(string source, string value)
|
||||
{
|
||||
Source = source;
|
||||
|
@ -27,6 +27,9 @@ using System.Reflection;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 轻量级的对象映射框架
|
||||
/// </summary>
|
||||
public static class Mapper
|
||||
{
|
||||
private static void Execute<T1, T2>(T1 source, T2 dest)
|
||||
@ -157,6 +160,13 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// T1映射到T2
|
||||
/// </summary>
|
||||
/// <typeparam name="T1">T1</typeparam>
|
||||
/// <typeparam name="T2">T2</typeparam>
|
||||
/// <param name="source">源</param>
|
||||
/// <param name="dest">目标</param>
|
||||
public static void MapperTo<T1, T2>(this T1 source, T2 dest)
|
||||
where T1 : class
|
||||
where T2 : class
|
||||
@ -164,6 +174,13 @@ namespace Sunny.UI
|
||||
Execute(source, dest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// T1从T2映射
|
||||
/// </summary>
|
||||
/// <typeparam name="T1">T1</typeparam>
|
||||
/// <typeparam name="T2">T2</typeparam>
|
||||
/// <param name="source">源</param>
|
||||
/// <param name="dest">目标</param>
|
||||
public static void MapperFrom<T1, T2>(this T1 dest, T2 source)
|
||||
where T1 : class
|
||||
where T2 : class
|
||||
@ -171,6 +188,11 @@ namespace Sunny.UI
|
||||
Execute(source, dest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取数组的类类型
|
||||
/// </summary>
|
||||
/// <param name="t">类型</param>
|
||||
/// <returns>类类型</returns>
|
||||
public static Type GetArrayElementType(this Type t)
|
||||
{
|
||||
if (!t.IsArray) return null;
|
||||
|
@ -33,6 +33,7 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
/// <summary>
|
||||
/// 轻便消息窗
|
||||
/// </summary>
|
||||
@ -1967,4 +1968,6 @@ namespace Sunny.UI
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -1,32 +1,65 @@
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 其他
|
||||
/// </summary>
|
||||
public static class UIOther
|
||||
{
|
||||
/// <summary>
|
||||
/// 值不为数字
|
||||
/// </summary>
|
||||
/// <param name="d">值</param>
|
||||
/// <returns>不为数字</returns>
|
||||
public static bool IsNan(this double d)
|
||||
{
|
||||
return double.IsNaN(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值不为数字
|
||||
/// </summary>
|
||||
/// <param name="d">值</param>
|
||||
/// <returns>不为数字</returns>
|
||||
public static bool IsNan(this float d)
|
||||
{
|
||||
return float.IsNaN(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值负无穷或者正无穷
|
||||
/// </summary>
|
||||
/// <param name="d">值</param>
|
||||
/// <returns>负无穷或者正无穷</returns>
|
||||
public static bool IsInfinity(this double d)
|
||||
{
|
||||
return double.IsInfinity(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值负无穷或者正无穷
|
||||
/// </summary>
|
||||
/// <param name="d">值</param>
|
||||
/// <returns>负无穷或者正无穷</returns>
|
||||
public static bool IsInfinity(this float d)
|
||||
{
|
||||
return float.IsInfinity(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值不为数字或者负无穷或者正无穷
|
||||
/// </summary>
|
||||
/// <param name="d">值</param>
|
||||
/// <returns>不为数字或者负无穷或者正无穷</returns>
|
||||
public static bool IsNanOrInfinity(this double d)
|
||||
{
|
||||
return d.IsNan() || d.IsInfinity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值不为数字或者负无穷或者正无穷
|
||||
/// </summary>
|
||||
/// <param name="d">值</param>
|
||||
/// <returns>不为数字或者负无穷或者正无穷</returns>
|
||||
public static bool IsNanOrInfinity(this float d)
|
||||
{
|
||||
return d.IsNan() || d.IsInfinity();
|
||||
|
@ -26,14 +26,19 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 滚动条信息获取类
|
||||
/// </summary>
|
||||
public static class ScrollBarInfo
|
||||
{
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public const int SIF_RANGE = 1;
|
||||
public const int SIF_PAGE = 2;
|
||||
public const int SIF_POS = 4;
|
||||
public const int SIF_TRACKPOS = 16;
|
||||
public const int SIF_DISABLENOSCROLL = 8;
|
||||
public const int SIF_ALL = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS;
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
|
||||
//私有方法
|
||||
private static uint MakeLong(short lowPart, short highPart)
|
||||
@ -41,18 +46,26 @@ namespace Sunny.UI
|
||||
return (ushort)lowPart | (uint)(highPart << 16);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 垂直滚动条宽度
|
||||
/// </summary>
|
||||
/// <returns>宽度</returns>
|
||||
public static int VerticalScrollBarWidth()
|
||||
{
|
||||
return SystemInformation.VerticalScrollBarWidth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 水平滚动条高度
|
||||
/// </summary>
|
||||
/// <returns>高度</returns>
|
||||
public static int HorizontalScrollBarHeight()
|
||||
{
|
||||
return SystemInformation.HorizontalScrollBarHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取控件滚动条信息
|
||||
/// 获取垂直控件滚动条信息
|
||||
/// </summary>
|
||||
/// <param name="handle">控件句柄</param>
|
||||
/// <returns>信息结构</returns>
|
||||
@ -65,6 +78,11 @@ namespace Sunny.UI
|
||||
return si;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取水平控件滚动条信息
|
||||
/// </summary>
|
||||
/// <param name="handle">控件句柄</param>
|
||||
/// <returns>信息结构</returns>
|
||||
public static SCROLLINFO GetHorInfo(IntPtr handle)
|
||||
{
|
||||
SCROLLINFO si = new SCROLLINFO();
|
||||
@ -118,12 +136,22 @@ namespace Sunny.UI
|
||||
User.SendMessage(handle, User.WM_VSCROLL, User.SB_LINEDOWN, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 垂直滚动条是否显示
|
||||
/// </summary>
|
||||
/// <param name="ctrl">控件</param>
|
||||
/// <returns>垂直滚动条是否显示</returns>
|
||||
public static bool IsVerticalScrollBarVisible(Control ctrl)
|
||||
{
|
||||
if (!ctrl.IsHandleCreated) return false;
|
||||
return (Sunny.UI.Win32.User.GetWindowLong(ctrl.Handle, User.GWL_STYLE) & User.WS_VSCROLL) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 水平滚动条是否显示
|
||||
/// </summary>
|
||||
/// <param name="ctrl">控件</param>
|
||||
/// <returns>水平滚动条是否显示</returns>
|
||||
public static bool IsHorizontalScrollBarVisible(Control ctrl)
|
||||
{
|
||||
if (!ctrl.IsHandleCreated) return false;
|
||||
|
@ -34,6 +34,9 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
public static class SuspendCtrlAltDelete
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取权限
|
||||
/// </summary>
|
||||
public static void GetSeDebugPrivilege()
|
||||
{
|
||||
IntPtr hToken;
|
||||
@ -78,6 +81,9 @@ namespace Sunny.UI
|
||||
CloseHandle(hToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 挂起
|
||||
/// </summary>
|
||||
public static void Suspend()
|
||||
{
|
||||
Process[] processes = Process.GetProcesses();
|
||||
@ -93,6 +99,9 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 恢复
|
||||
/// </summary>
|
||||
public static void Resume()
|
||||
{
|
||||
Process[] processes = Process.GetProcesses();
|
||||
|
@ -58,17 +58,23 @@ namespace Sunny.UI
|
||||
User.SetProcessDPIAware();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工具栏可用
|
||||
/// </summary>
|
||||
public static void EnabledTaskManager()
|
||||
{
|
||||
RegistryDisableTaskMgr(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工具栏不可用
|
||||
/// </summary>
|
||||
public static void DisabledTaskManager()
|
||||
{
|
||||
RegistryDisableTaskMgr(1);
|
||||
}
|
||||
|
||||
public static void RegistryDisableTaskMgr(int value)
|
||||
private static void RegistryDisableTaskMgr(int value)
|
||||
{
|
||||
string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";
|
||||
RegistryKey mKey = Registry.CurrentUser.CreateSubKey(subKey);
|
||||
@ -76,6 +82,9 @@ namespace Sunny.UI
|
||||
mKey?.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置键盘鼠标钩子超时
|
||||
/// </summary>
|
||||
public static void RegistryHooksTimeout()
|
||||
{
|
||||
string subKey = @"Control Panel\Desktop";
|
||||
@ -106,6 +115,13 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线程安全调用
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <param name="control">控件</param>
|
||||
/// <param name="method">方法</param>
|
||||
/// <returns>类型</returns>
|
||||
public static T ThreadSafeCall<T>(this Control control, Func<T> method)
|
||||
{
|
||||
if (control.InvokeRequired)
|
||||
@ -150,7 +166,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 是否64位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>是否64位</returns>
|
||||
public static bool Is64bitApp()
|
||||
{
|
||||
return IntPtr.Size == 8;
|
||||
@ -330,7 +346,7 @@ namespace Sunny.UI
|
||||
HandleRunningInstance(instance, showStyle);
|
||||
}
|
||||
|
||||
public static Process RunningInstance()
|
||||
private static Process RunningInstance()
|
||||
{
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
Process[] processes = Process.GetProcessesByName(currentProcess.ProcessName);
|
||||
|
@ -21,8 +21,14 @@
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 多语翻译接口
|
||||
/// </summary>
|
||||
public interface ITranslate
|
||||
{
|
||||
/// <summary>
|
||||
/// 多语翻译接口
|
||||
/// </summary>
|
||||
void Translate();
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
internal class ColorSlider : LabelRotate
|
||||
{
|
||||
public event EventHandler SelectedValueChanged;
|
||||
@ -315,7 +313,4 @@ namespace Sunny.UI
|
||||
SelectedHSLColor = m_selectedColor;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -7,7 +7,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
[ToolboxItem(false)]
|
||||
public sealed class UIColorTable : LabelRotate
|
||||
@ -394,6 +393,5 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -7,7 +7,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
[ToolboxItem(false)]
|
||||
public sealed class UIColorWheel : Control, IStyleInterface, IZoomScale
|
||||
@ -366,6 +365,5 @@ namespace Sunny.UI
|
||||
public string TagString { get; set; }
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -5,7 +5,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct HSLColor
|
||||
{
|
||||
@ -316,9 +315,8 @@ namespace Sunny.UI
|
||||
|
||||
public static ImageList ImageList()
|
||||
{
|
||||
Type t = typeof(SelectorImages);
|
||||
if (m_imageList == null)
|
||||
m_imageList = ImageEx.GetToolbarImageList(t, Properties.Resources.colorbarIndicators, new Size(12, 12), Color.Magenta);
|
||||
m_imageList = ImageEx.GetToolbarImageList(Properties.Resources.colorbarIndicators, new Size(12, 12), Color.Magenta);
|
||||
return m_imageList;
|
||||
}
|
||||
|
||||
@ -328,6 +326,5 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -4,7 +4,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
[ToolboxItem(false)]
|
||||
public class LabelRotate : Control, IStyleInterface, IZoomScale
|
||||
@ -278,6 +277,5 @@ namespace Sunny.UI
|
||||
public string TagString { get; set; }
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -62,7 +62,6 @@ to represent the company, product, or service to which they refer.
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
/// <summary>
|
||||
/// FontAwesome.ttf V4.7
|
||||
@ -1251,6 +1250,5 @@ namespace Sunny.UI
|
||||
public const int icon_clipboard = 0xe0e6;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -62,7 +62,6 @@ to represent the company, product, or service to which they refer.
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
/// <summary>
|
||||
/// fa-regular-400.ttf
|
||||
@ -1702,6 +1701,5 @@ namespace Sunny.UI
|
||||
public const int fa_yin_yang = 0xf6ad;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -25,7 +25,6 @@ using System.Drawing;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public class UIBaseStyle
|
||||
{
|
||||
@ -718,6 +717,5 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
<AssemblyOriginatorKeyFile>D:\MyDocuments\SunnyUI.pfx</AssemblyOriginatorKeyFile>
|
||||
<DelaySign>False</DelaySign>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public static class Win32Helper
|
||||
{
|
||||
@ -188,6 +187,5 @@ namespace Sunny.UI.Win32
|
||||
public delegate void TimerSetEventCallback(int uTimerID, uint uMsg, uint dwUser, UIntPtr dw1, UIntPtr dw2);
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public abstract class ERROR
|
||||
{
|
||||
@ -928,6 +927,5 @@ namespace Sunny.UI.Win32
|
||||
public const int VIEW_S_LAST = 0x4014F;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -6,7 +6,6 @@ using HWND = System.IntPtr;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct XFORM
|
||||
{
|
||||
@ -1999,6 +1998,5 @@ namespace Sunny.UI.Win32
|
||||
public const int WINDING = 2;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -7,7 +7,6 @@ using HWND = System.IntPtr;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct OVERLAPPED
|
||||
{
|
||||
@ -2397,6 +2396,5 @@ namespace Sunny.UI.Win32
|
||||
public const string SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege";
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -7,7 +7,6 @@ using HWND = System.IntPtr;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct SMPTE
|
||||
{
|
||||
@ -1488,6 +1487,5 @@ namespace Sunny.UI.Win32
|
||||
public const string CFSEPCHAR = "+";
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -7,7 +7,6 @@ using HWND = System.IntPtr;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct NETRESOURCE
|
||||
{
|
||||
@ -212,6 +211,5 @@ namespace Sunny.UI.Win32
|
||||
public const int WN_WINDOWS_ERROR = ERROR.ERROR_UNEXP_NET_ERR;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -4,7 +4,6 @@ using HWND = System.IntPtr;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct DRAGINFO
|
||||
{
|
||||
@ -189,6 +188,5 @@ namespace Sunny.UI.Win32
|
||||
public const int SHGNLI_PREFIXNAME = 0x2;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -7,7 +7,6 @@ using HWND = System.IntPtr;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct CBTACTIVATESTRUCT
|
||||
{
|
||||
@ -2539,6 +2538,5 @@ namespace Sunny.UI.Win32
|
||||
public const string SZDDE_ITEM_ITEMLIST = "TopicItemList";
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
@ -2,7 +2,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sunny.UI.Win32
|
||||
{
|
||||
#pragma warning disable CS0618 // 类型或成员已过时
|
||||
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
public struct RECT
|
||||
{
|
||||
@ -147,6 +146,5 @@ namespace Sunny.UI.Win32
|
||||
public short wMilliseconds;
|
||||
}
|
||||
|
||||
#pragma warning restore CS0618 // 类型或成员已过时
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user