windows窗體的標題欄無法直接通過一些默認的事件來控制
using System
namespace WindowsApplication
{
public partial class Form
{
public Form
//攔擊標題欄鼠標位置事件
const int WM_NCHITTEST =
protected override void WndProc(ref Message m)
{
base
{
switch (m
{
case
m
case
m
case
default: Console
}
}
}
}
}
下面是各個常量的意義
{ WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes }
{$EXTERNALSYM HTERROR}
HTERROR =
{$EXTERNALSYM HTTRANSPARENT}
HTTRANSPARENT =
{$EXTERNALSYM HTNOWHERE}
HTNOWHERE =
{$EXTERNALSYM HTCLIENT}
HTCLIENT =
{$EXTERNALSYM HTCAPTION}
HTCAPTION =
{$EXTERNALSYM HTSYSMENU}
HTSYSMENU =
{$EXTERNALSYM HTGROWBOX}
HTGROWBOX =
{$EXTERNALSYM HTSIZE}
HTSIZE = HTGROWBOX;
{$EXTERNALSYM HTMENU}
HTMENU =
{$EXTERNALSYM HTHSCROLL}
HTHSCROLL =
{$EXTERNALSYM HTVSCROLL}
HTVSCROLL =
{$EXTERNALSYM HTMINBUTTON}
HTMINBUTTON =
{$EXTERNALSYM HTMAXBUTTON}
HTMAXBUTTON =
{$EXTERNALSYM HTLEFT}
HTLEFT =
{$EXTERNALSYM HTRIGHT}
HTRIGHT =
{$EXTERNALSYM HTTOP}
HTTOP =
{$EXTERNALSYM HTTOPLEFT}
HTTOPLEFT =
{$EXTERNALSYM HTTOPRIGHT}
HTTOPRIGHT =
{$EXTERNALSYM HTBOTTOM}
HTBOTTOM =
{$EXTERNALSYM HTBOTTOMLEFT}
HTBOTTOMLEFT =
{$EXTERNALSYM HTBOTTOMRIGHT}
HTBOTTOMRIGHT =
{$EXTERNALSYM HTBORDER}
HTBORDER =
{$EXTERNALSYM HTREDUCE}
HTREDUCE = HTMINBUTTON;
{$EXTERNALSYM HTZOOM}
HTZOOM = HTMAXBUTTON;
{$EXTERNALSYM HTSIZEFIRST}
HTSIZEFIRST = HTLEFT;
{$EXTERNALSYM HTSIZELAST}
HTSIZELAST = HTBOTTOMRIGHT;
{$EXTERNALSYM HTOBJECT}
HTOBJECT =
{$EXTERNALSYM HTCLOSE}
HTCLOSE =
{$EXTERNALSYM HTHELP}
HTHELP =
From:http://tw.wingwit.com/Article/program/net/201311/12981.html