Can you make a Borderless Application Main Window in Windows, without WS_POPUP style?

后端 未结 3 659
灰色年华
灰色年华 2020-12-05 12:35

I want to create a window that will be the main window and that Windows itself recognizes as a main application window. However, when I make my window borderless, and witho

3条回答
  •  时光取名叫无心
    2020-12-05 13:00

    A bit icky, but you can set the window region by putting this in YourForm.OnShow event:

    var
      r: TRect;
    begin
      r := ClientRect;
      OffsetRect(r, 0, GetSystemMetrics(SM_CYCAPTION));
      OffsetRect(r, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME));
      SetWindowRgn(Handle, 
          CreateRectRgn(
              r.Left, r.Top, 
              ClientWidth + r.Left, ClientHeight + r.Top), True);
    

提交回复
热议问题