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
|
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[DllImport("user32")]
static extern int SetWindowPos(int hwnd,
int hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
int wFlags);
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
public const int SWP_NOACTIVATE = 0x10;
public const int SWP_SHOWWINDOW = 0x40;
public const int SWP_NOMOVE = 2;
public const int SWP_NOSIZE = 1;
public Form1()
{
InitializeComponent();
SetWindowPos(this.Handle.ToInt32(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
} |
Partager