-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
65 lines (62 loc) · 2.21 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Configuration;
using System.Windows.Forms;
using System.Collections.Specialized;
namespace DropTransfer
{
static class Program
{
public static transDropBucket browser;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
NameValueCollection section = ConfigurationManager.GetSection("System.Windows.Forms.ApplicationConfigurationSection") as NameValueCollection;
if (section != null)
{
section["DpiAwareness"] = "PerMonitorV2";
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
browser = new transDropBucket();
Application.AddMessageFilter(new MouseMoveFilter());
Application.Run(browser);
}
public class MouseMoveFilter : IMessageFilter
{
bool mouseOut = true;
#region IMessageFilter Members
private const int WM_MOUSELEAVE = 0x02A3;
private const int WM_NCMOUSEMOVE = 0x0A0;
private const int WM_MOUSEMOVE = 0x0200;
private const int WM_NCMOUSELEAVE = 0x2A2;
public bool PreFilterMessage(ref Message m)
{
switch (m.Msg)
{
case WM_NCMOUSEMOVE:
case WM_MOUSEMOVE:
if (mouseOut)
{
if (browser.Foldable)
browser.Unfold();
mouseOut = false;
}
break;
case WM_NCMOUSELEAVE:
case WM_MOUSELEAVE:
if (!browser.Bounds.Contains(Control.MousePosition))
{
if (browser.Foldable) browser.Fold();
mouseOut = true;
}
break;
}
return false;
}
#endregion
}
}
}