zl程序教程

您现在的位置是:首页 >  后端

当前栏目

C#改变无边框窗体尺寸大小的方法

c#方法 改变 大小 窗体 尺寸 边框
2023-06-13 09:15:06 时间

复制代码代码如下:


CodehighlightingproducedbyActiproCodeHighlighter(freeware)
constintHTLEFT=10;
constintHTRIGHT=11;
constintHTTOP=12;
constintHTTOPLEFT=13;
constintHTTOPRIGHT=14;
constintHTBOTTOM=15;
constintHTBOTTOMLEFT=0x10;
constintHTBOTTOMRIGHT=17;

protectedoverridevoidWndProc(refMessagem)
{
   switch(m.Msg)
   {
       case0x0084:
           base.WndProc(refm);
           PointvPoint=newPoint((int)m.LParam&0xFFFF,
               (int)m.LParam>>16&0xFFFF);
           vPoint=PointToClient(vPoint);
           if(vPoint.X<=5)
               if(vPoint.Y<=5)
                   m.Result=(IntPtr)HTTOPLEFT;
               elseif(vPoint.Y>=ClientSize.Height-5)
                   m.Result=(IntPtr)HTBOTTOMLEFT;
               elsem.Result=(IntPtr)HTLEFT;
           elseif(vPoint.X>=ClientSize.Width-5)
               if(vPoint.Y<=5)
                   m.Result=(IntPtr)HTTOPRIGHT;
               elseif(vPoint.Y>=ClientSize.Height-5)
                   m.Result=(IntPtr)HTBOTTOMRIGHT;
               elsem.Result=(IntPtr)HTRIGHT;
           elseif(vPoint.Y<=5)
               m.Result=(IntPtr)HTTOP;
           elseif(vPoint.Y>=ClientSize.Height-5)
               m.Result=(IntPtr)HTBOTTOM;
           break;
       case0x0201://鼠标左键按下的消息
           m.Msg=0x00A1;//更改消息为非客户区按下鼠标
           m.LParam=IntPtr.Zero;//默认值
           m.WParam=newIntPtr(2);//鼠标放在标题栏内
           base.WndProc(refm);
           break;
       default:
           base.WndProc(refm);
           break;
   }
}