procedure TForm1.Button1Click(Sender: TObject);
begin
//隐藏标题栏
SetWindowLong(Form1.Handle,GWL_STYLE, GetWindowLong(Handle,GWL_STYLE)
and
not WS_CAPTION);
Height
:=ClientHeight;
end;
C# 去除无边框
[System.Runtime.InteropServices.DllImport("USER32.DLL")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[System.Runtime.InteropServices.DllImport("USER32.DLL")]
public static extern int GetWindowLong(IntPtr hWnd, int 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 sender, EventArgs e)
{
int style = GetWindowLong(Handle, GWL_STYLE);
SetWindowLong(Handle, GWL_STYLE, (style & ~WS_CAPTION));
Height = ClientRectangle.Height;
}