Skip to content

Commit a94cc87

Browse files
committed
v2.3.0
1 parent 0c5c4ca commit a94cc87

39 files changed

+1238
-883
lines changed

.vs/QuickLibrary/v16/.suo

1.5 KB
Binary file not shown.
12 KB
Binary file not shown.

QuickLibrary/DialogMan.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Drawing;
2+
using System.Windows.Forms;
3+
4+
namespace QuickLibrary
5+
{
6+
public static class DialogMan
7+
{
8+
public static DialogResult ShowConfirmDialog(
9+
string messageText,
10+
string yesBtnText = "",
11+
Image yesBtnImage = null,
12+
bool showNoBtn = false,
13+
string noBtnText = "",
14+
Image noBtnImage = null,
15+
string windowTitle = "",
16+
bool darkMode = false
17+
)
18+
{
19+
YesNoForm cf = new YesNoForm(messageText, yesBtnText, yesBtnImage, showNoBtn, noBtnText, noBtnImage, windowTitle, darkMode);
20+
return cf.ShowDialog();
21+
}
22+
}
23+
}

QuickLibrary/DownloadForm.Designer.cs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QuickLibrary/DownloadForm.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ public DownloadForm(string url, bool darkMode)
3232

3333
if (darkMode)
3434
{
35-
DarkMode = darkMode;
36-
3735
cancelButton.BackColor = ThemeManager.DarkSecondColor;
3836
updateButton.BackColor = ThemeManager.DarkSecondColor;
3937
}
4038

41-
closeBtn.SetDarkMode(darkMode);
39+
DarkMode = darkMode;
40+
closeBtn.DarkMode = darkMode;
4241
manuallyLink.LinkColor = ThemeManager.AccentColor;
4342

4443
wc = new WebClient();

QuickLibrary/DropShadow.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ namespace QuickLibrary
77
{
88
public class DropShadow
99
{
10-
#region Shadowing
11-
12-
#region Fields
13-
1410
private const int WM_NCHITTEST = 0x84;
1511
private const int WS_MINIMIZEBOX = 0x20000;
1612
private const int HTCLIENT = 0x1;
@@ -20,10 +16,6 @@ public class DropShadow
2016
private const int WM_NCPAINT = 0x0085;
2117
private const int WM_ACTIVATEAPP = 0x001C;
2218

23-
#endregion
24-
25-
#region Structures
26-
2719
[EditorBrowsable(EditorBrowsableState.Never)]
2820
public struct MARGINS
2921
{
@@ -33,12 +25,6 @@ public struct MARGINS
3325
public int bottomHeight;
3426
}
3527

36-
#endregion
37-
38-
#region Methods
39-
40-
#region Public
41-
4228
[DllImport("dwmapi.dll")]
4329
[EditorBrowsable(EditorBrowsableState.Never)]
4430
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
@@ -62,10 +48,6 @@ public static bool IsCompositionEnabled()
6248
return enabled;
6349
}
6450

65-
#endregion
66-
67-
#region Private
68-
6951
[DllImport("dwmapi.dll")]
7052
private static extern int DwmIsCompositionEnabled(out bool enabled);
7153

@@ -92,10 +74,6 @@ private bool CheckIfAeroIsEnabled()
9274
return false;
9375
}
9476

95-
#endregion
96-
97-
#region Overrides
98-
9977
public void ApplyShadows(Form form)
10078
{
10179
var v = 2;
@@ -112,11 +90,5 @@ public void ApplyShadows(Form form)
11290

11391
DwmExtendFrameIntoClientArea(form.Handle, ref margins);
11492
}
115-
116-
#endregion
117-
118-
#endregion
119-
120-
#endregion
12193
}
12294
}

QuickLibrary/NCRenderer.cs

Lines changed: 0 additions & 82 deletions
This file was deleted.

QuickLibrary/NativeMethodsManager.cs renamed to QuickLibrary/NativeMan.cs

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using System;
22
using System.Runtime.InteropServices;
33

4-
54
namespace QuickLibrary
65
{
7-
public static class NativeMethodsManager
6+
public static class NativeMan
87
{
98
// CONSTANTS
109

@@ -18,12 +17,31 @@ public static class NativeMethodsManager
1817
public const int WM_POPUPSYSTEMMENU = 0x313;
1918
public const int WM_SYSCOMMAND = 0x0112;
2019
public const int SC_MAXIMIZE = 0xF030;
20+
public const int SC_RESTORE = 0xF120;
2121
public const int EM_SETMARGINS = 0xd3;
2222
public const int EC_RIGHTMARGIN = 2;
2323
public const int EC_LEFTMARGIN = 1;
2424

2525
// ENUMS
2626

27+
/// <summary>
28+
/// Represents possible dialogbox command id values by the MB_GetString function.
29+
/// </summary>
30+
public enum DialogBoxCommandID : int
31+
{
32+
IDOK = 0,
33+
IDCANCEL = 1,
34+
IDABORT = 2,
35+
IDRETRY = 3,
36+
IDIGNORE = 4,
37+
IDYES = 5,
38+
IDNO = 6,
39+
IDCLOSE = 7,
40+
IDHELP = 8,
41+
IDTRYAGAIN = 9,
42+
IDCONTINUE = 10
43+
}
44+
2745
public enum ScrollBarType : uint
2846
{
2947
SbHorz = 0,
@@ -56,33 +74,54 @@ public struct MARGINS
5674

5775
// USER32 METHODS
5876

59-
[DllImport("user32.dll")]
77+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
78+
public static extern IntPtr MB_GetString(int strId);
79+
80+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
6081
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
6182

62-
[DllImport("user32.dll")]
83+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
6384
public extern static int SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
6485

65-
[DllImport("user32.dll")]
86+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
6687
public static extern bool ReleaseCapture();
6788

68-
[DllImport("user32.dll", SetLastError = true)]
89+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
6990
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
7091

71-
[DllImport("user32.dll", SetLastError = true)]
92+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
7293
public static extern IntPtr FindWindowEx(IntPtr hP, IntPtr hC, string sC, string sW);
7394

74-
[DllImport("user32.dll", SetLastError = true)]
95+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
7596
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
7697

77-
[DllImport("user32.dll", SetLastError = true)]
98+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
7899
public static extern IntPtr FindWindow(string lpWindowClass, string lpWindowName);
79100

80-
[DllImport("user32.dll")]
101+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
81102
public extern static int GetScrollPos(IntPtr hWnd, int nBar);
82103

83104
// DWMAPI METHODS
84105

85-
[DllImport("dwmapi.dll")]
106+
[DllImport("dwmapi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
86107
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);
87-
}
108+
109+
// CUSTOM METHODS
110+
111+
public static string GetMessageBoxText(DialogBoxCommandID messageId)
112+
{
113+
string str = Marshal.PtrToStringAuto(MB_GetString((int)messageId));
114+
if (str[0] == '&')
115+
{
116+
str = str.Substring(1, str.Length - 1);
117+
}
118+
return str;
119+
}
120+
121+
public static void DragWindow(IntPtr handle)
122+
{
123+
ReleaseCapture();
124+
SendMessage(handle, 0xA1, 0x2, 0);
125+
}
126+
}
88127
}

QuickLibrary/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.2.7")]
36-
[assembly: AssemblyFileVersion("2.2.7")]
35+
[assembly: AssemblyVersion("2.3.0")]
36+
[assembly: AssemblyFileVersion("2.3.0")]
3737
[assembly: NeutralResourcesLanguage("en")]

0 commit comments

Comments
 (0)