-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBackingForm.cs
62 lines (51 loc) · 1.63 KB
/
BackingForm.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
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;
namespace FMUtils.Screenshot
{
public class DWMBackingForm : Form
{
const int WS_EX_NOACTIVATE = 0x08000000;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_TOPMOST = 0x00000008;
protected override bool ShowWithoutActivation
{
get
{
return true;
}
}
protected override CreateParams CreateParams
{
get
{
CreateParams baseParams = base.CreateParams;
baseParams.ExStyle |= (int)(WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST);
return baseParams;
}
}
public DWMBackingForm(Color color, Rectangle position)
{
Trace.WriteLine(string.Format("Creating backing form at {0}", position), "DWMBackingForm.ctor");
FormBorderStyle = FormBorderStyle.None;
BackColor = color;
Location = position.Location;
Size = position.Size;
StartPosition = FormStartPosition.Manual;
WindowState = FormWindowState.Normal;
ShowInTaskbar = false;
TopMost = true;
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// DWMBackingForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(278, 245);
this.Name = "DWMBackingForm";
this.ResumeLayout(false);
}
}
}