优化更新代码,添加界面功能并整合

This commit is contained in:
GG Z
2025-02-10 20:53:40 +08:00
parent 83b846f15f
commit 978e03a67f
1389 changed files with 95739 additions and 22200 deletions

View File

@@ -0,0 +1,37 @@
/* This Source Code is partially based on reverse engineering of the Windows Operating System,
and is intended for use on Windows systems only.
This Source Code is partially based on the source code provided by the .NET Foundation. */
using System.Runtime.InteropServices;
namespace WPFluent.Interop.WinDef;
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
/// <summary>
/// The POINT structure defines the x- and y-coordinates of a point.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
/// <summary>
/// Specifies the x-coordinate of the point.
/// </summary>
public int x;
/// <summary>
/// Specifies the y-coordinate of the point.
/// </summary>
public int y;
}
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter

View File

@@ -0,0 +1,32 @@
/* This Source Code is partially based on reverse engineering of the Windows Operating System,
and is intended for use on Windows systems only.
This Source Code is partially based on the source code provided by the .NET Foundation. */
using System.Runtime.InteropServices;
namespace WPFluent.Interop.WinDef;
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
/// <summary>
/// The <see cref="POINTL"/> structure defines the x- and y-coordinates of a point.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct POINTL
{
/// <summary>
/// Specifies the x-coordinate of the point.
/// </summary>
public long x;
/// <summary>
/// Specifies the y-coordinate of the point.
/// </summary>
public long y;
}
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter

View File

@@ -0,0 +1,26 @@
using System.Runtime.InteropServices;
namespace WPFluent.Interop.WinDef;
[StructLayout(LayoutKind.Sequential)]
public struct RECT(int left, int top, int right, int bottom)
{
public int Left = left;
public int Top = top;
public int Right = right;
public int Bottom = bottom;
public int Width => Right - Left;
public int Height => Bottom - Top;
public void Offset(int dx, int dy)
{
Left += dx;
Top += dy;
Right += dx;
Bottom += dy;
}
public bool IsEmpty => Left >= Right || Top >= Bottom;
}

View File

@@ -0,0 +1,121 @@
/* This Source Code is partially based on reverse engineering of the Windows Operating System,
and is intended for use on Windows systems only.
This Source Code is partially based on the source code provided by the .NET Foundation. */
using System.Runtime.InteropServices;
namespace WPFluent.Interop.WinDef;
// ReSharper disable InconsistentNaming
/// <summary>
/// The RECTL structure defines a rectangle by the coordinates of its upper-left and lower-right corners.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct RECTL
{
private long _left;
private long _top;
private long _right;
private long _bottom;
public static bool operator !=(RECTL left, RECTL right)
{
return !(left == right);
}
public static bool operator ==(RECTL left, RECTL right)
{
return left.Equals(right);
}
/// <inheritdoc/>
public override readonly bool Equals(object? obj)
{
if(obj is not RECTL)
{
return false;
}
try
{
var rc = (RECTL)obj;
return rc._bottom == _bottom && rc._left == _left && rc._right == _right && rc._top == _top;
} catch(InvalidCastException)
{
return false;
}
}
/// <inheritdoc/>
public override readonly int GetHashCode()
{ return _top.GetHashCode() ^ _bottom.GetHashCode() ^ _left.GetHashCode() ^ _right.GetHashCode(); }
/// <summary>
/// Sets offset of the rectangle.
/// </summary>
public void Offset(int dx, int dy)
{
_left += dx;
_top += dy;
_right += dx;
_bottom += dy;
}
/// <summary>
/// Combines two RECTLs
/// </summary>
public static RECTL Union(RECTL rect1, RECTL rect2)
{
return new RECTL
{
Left = Math.Min(rect1.Left, rect2.Left),
Top = Math.Min(rect1.Top, rect2.Top),
Right = Math.Max(rect1.Right, rect2.Right),
Bottom = Math.Max(rect1.Bottom, rect2.Bottom),
};
}
/// <summary>
/// Gets or sets the y-coordinate of the lower-right corner of the rectangle.
/// </summary>
public long Bottom { readonly get { return _bottom; } set { _bottom = value; } }
/// <summary>
/// Gets the height of the rectangle.
/// </summary>
public readonly long Height { get { return _bottom - _top; } }
/// <summary>
/// Gets or sets the x-coordinate of the upper-left corner of the rectangle.
/// </summary>
public long Left { readonly get { return _left; } set { _left = value; } }
/// <summary>
/// Gets the position of the rectangle.
/// </summary>
public POINTL Position { get { return new POINTL { x = _left, y = _top }; } }
/// <summary>
/// Gets or sets the x-coordinate of the lower-right corner of the rectangle.
/// </summary>
public long Right { readonly get { return _right; } set { _right = value; } }
/// <summary>
/// Gets the size of the rectangle.
/// </summary>
public SIZE Size { get { return new SIZE { cx = Width, cy = Height }; } }
/// <summary>
/// Gets or sets the y-coordinate of the upper-left corner of the rectangle.
/// </summary>
public long Top { readonly get { return _top; } set { _top = value; } }
/// <summary>
/// Gets the width of the rectangle.
/// </summary>
public readonly long Width { get { return _right - _left; } }
}

View File

@@ -0,0 +1,32 @@
/* This Source Code is partially based on reverse engineering of the Windows Operating System,
and is intended for use on Windows systems only.
This Source Code is partially based on the source code provided by the .NET Foundation. */
using System.Runtime.InteropServices;
namespace WPFluent.Interop.WinDef;
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
/// <summary>
/// The SIZE structure defines the width and height of a rectangle.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SIZE
{
/// <summary>
/// Specifies the rectangle's width. The units depend on which function uses this structure.
/// </summary>
public long cx;
/// <summary>
/// Specifies the rectangle's height. The units depend on which function uses this structure.
/// </summary>
public long cy;
}
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter