procedure TForm1.Button1Click(Sender: TObject); 
begin
       //隐藏标题栏
      SetWindowLong(Form1.Handle,GWL_STYLE, GetWindowLong(Handle,GWL_STYLE) and not WS_CAPTION);
      Height:=ClientHeight;
end;

 



C# 去除无边框

 

SetWindowLong 除去窗体标题栏

        [System.Runtime.InteropServices.DllImport("USER32.DLL")]
        public static extern int SetWindowLong(IntPtr hWndint nIndexint dwNewLong);
 
        [System.Runtime.InteropServices.DllImport("USER32.DLL")]
        public static extern int GetWindowLong(IntPtr hWndint nIndex);
 
        public static int GWL_STYLE = -16;
        public static int WS_CHILD = 0x40000000; //child window
        public static int WS_BORDER = 0x00800000; //window with border
        public static int WS_DLGFRAME = 0x00400000; //window with double border but no title
        public static int WS_CAPTION = WS_BORDER | WS_DLGFRAME//window with a title bar
 
        private void Form1_Load(object senderEventArgs e)
        {
            int style = GetWindowLong(HandleGWL_STYLE);
            SetWindowLong(HandleGWL_STYLE, (style & ~WS_CAPTION));
            Height = ClientRectangle.Height;

        }  

相关文章:

  • 2022-12-23
  • 2021-07-23
  • 2021-10-29
  • 2021-06-26
  • 2022-02-07
  • 2022-12-23
  • 1970-01-01
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-10-31
  • 2021-08-05
  • 2018-06-28
  • 2021-08-31
相关资源
相似解决方案