private
void
ptbTopLeft_MouseMove(
object
sender, MouseEventArgs e)
{
if
(WindowState
==
FormWindowState.Maximized)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog
||
this
.FormStyle
==
FormBorderStyle.Fixed3D)
{
((Control)sender).Cursor
=
Cursors.Default;
if
(e.Button
==
MouseButtons.Left
&&
e.Y
<=
SystemInformation.CaptionHeight)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
9
,
0
);
}
return
;
}
if
(e.X
<=
8
&&
e.Y
<=
8
)
{
((Control)sender).Cursor
=
Cursors.SizeNWSE;
if
(e.Button
==
MouseButtons.Left) { Win32.ReleaseCapture(); Win32.SendMessage(Handle,
274
,
61440
+
4
,
0
); }
}
else
if
(e.X
<=
4
)
{
((Control)sender).Cursor
=
Cursors.SizeWE;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
1
,
0
);
}
}
else
if
(e.Y
<=
4
)
{
((Control)sender).Cursor
=
Cursors.SizeNS;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
3
,
0
);
}
}
else
{
((Control)sender).Cursor
=
Cursors.Default;
if
(e.Button
==
MouseButtons.Left
&&
e.Y
<=
SystemInformation.CaptionHeight)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
9
,
0
);
}
}
}
private
void
ptbTopMiddle_MouseMove(
object
sender, MouseEventArgs e)
{
if
(WindowState
==
FormWindowState.Maximized)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog
||
this
.FormStyle
==
FormBorderStyle.Fixed3D)
{
((Control)sender).Cursor
=
Cursors.Default;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
9
,
0
);
}
return
;
}
if
(e.Y
<=
2
)
{
((Control)sender).Cursor
=
Cursors.SizeNS;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
3
,
0
);
}
}
else
{
((Control)sender).Cursor
=
Cursors.Default;
if
(e.Button
==
MouseButtons.Left
&&
e.Y
<=
SystemInformation.CaptionHeight)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
9
,
0
);
}
}
}
private
void
ptbTopRight_MouseMove(
object
sender, MouseEventArgs e)
{
if
(WindowState
==
FormWindowState.Maximized)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.Fixed3D)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog)
return
;
if
(WindowState
==
FormWindowState.Maximized)
return
;
if
(e.Y
>
8
)
{
ptbTopRight.Cursor
=
Cursors.SizeWE;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
2
,
0
);
}
}
else
if
(e.X
>
5
)
{
((Control)sender).Cursor
=
Cursors.SizeNESW;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
5
,
0
);
}
}
else
{
((Control)sender).Cursor
=
Cursors.Default;
if
(e.Button
==
MouseButtons.Left
&&
e.Y
<=
SystemInformation.CaptionHeight)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
9
,
0
);
}
}
}
private
void
Caption_MouseUp(
object
sender, MouseEventArgs e)
{
if
(e.Button
==
MouseButtons.Right
&&
((Control)sender).Cursor
==
Cursors.Default
&&
e.Y
<=
SystemInformation.CaptionHeight)
{
}
if
(e.Y
<=
SystemInformation.CaptionHeight)
{
_captionMouseUp
=
e.Location;
}
else
{
_captionMouseUp
=
Point.Empty;
}
if
(
this
._skinForm
!=
null
&&
!
this
._skinForm.IsDisposed
&&
this
._skinForm.Visible)
{
this
._skinForm.Close();
}
}
private
void
Caption_DouClick(
object
sender, EventArgs e)
{
if
(((Control)sender).Cursor
!=
Cursors.Default)
return
;
if
(_captionMouseUp
==
Point.Empty)
return
;
Win32.ReleaseCapture();
if
(WindowState
!=
FormWindowState.Maximized)
{
Win32.ReleaseCapture();
Win32.SendMessage(
this
.Handle,
273
, Win32.SC_MAXIMIZE,
0
);
}
else
{
Win32.ReleaseCapture();
Win32.SendMessage(
this
.Handle,
273
, Win32.SC_RESTORE,
0
);
}
}
private
void
ptbLeft_MouseMove(
object
sender, MouseEventArgs e)
{
if
(
this
.FormStyle
==
FormBorderStyle.Fixed3D)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog)
return
;
if
(WindowState
==
FormWindowState.Maximized)
return
;
if
(e.Y
>
this
.ptbLeft.Height
-
5
)
{
this
.ptbBottomLeft.Cursor
=
Cursors.SizeNESW;
}
else
{
ptbLeft.Cursor
=
Cursors.SizeWE;
}
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
7
,
0
);
}
}
private
void
ptbRight_MouseMove(
object
sender, MouseEventArgs e)
{
if
(
this
.FormStyle
==
FormBorderStyle.Fixed3D)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog)
return
;
if
(WindowState
==
FormWindowState.Maximized)
return
;
this
.ptbRight.Cursor
=
Cursors.SizeWE;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
2
,
0
);
}
}
private
void
ptbBottomLeft_MouseMove(
object
sender, MouseEventArgs e)
{
if
(
this
.FormStyle
==
FormBorderStyle.Fixed3D)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog)
return
;
if
(WindowState
==
FormWindowState.Maximized)
return
;
this
.ptbRight.Cursor
=
Cursors.SizeNESW;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
7
,
0
);
}
}
private
void
ptbBottomMiddle_MouseMove(
object
sender, MouseEventArgs e)
{
if
(
this
.FormStyle
==
FormBorderStyle.Fixed3D)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog)
return
;
if
(WindowState
==
FormWindowState.Maximized)
return
;
((Control)sender).Cursor
=
Cursors.SizeNS;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
6
,
0
);
}
}
private
void
ptbBottomRight_MouseMove(
object
sender, MouseEventArgs e)
{
if
(
this
.FormStyle
==
FormBorderStyle.Fixed3D)
return
;
if
(
this
.FormStyle
==
FormBorderStyle.FixedDialog)
return
;
if
(WindowState
==
FormWindowState.Maximized)
return
;
((Control)sender).Cursor
=
Cursors.SizeNWSE;
if
(e.Button
==
MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle,
274
,
61440
+
8
,
0
);
}
}
private
void
btnMin_Click(
object
sender, EventArgs e)
{
Win32.ReleaseCapture();
Win32.SendMessage(
this
.Handle,
274
, Win32.SC_MINIMIZE,
0
);
}
private
void
btnMaxResore_Click(
object
sender, EventArgs e)
{
if
(
this
.WindowState
==
FormWindowState.Normal)
{
Win32.ReleaseCapture();
Win32.SendMessage(
this
.Handle,
274
, Win32.SC_MAXIMIZE,
0
);
}
else
{
Win32.ReleaseCapture();
Win32.SendMessage(
this
.Handle,
274
, Win32.SC_RESTORE,
0
);
}
}