Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法绕过Delphi VCL表单边界?_Delphi_Border_Frame - Fatal编程技术网

有没有办法绕过Delphi VCL表单边界?

有没有办法绕过Delphi VCL表单边界?,delphi,border,frame,Delphi,Border,Frame,我希望VCL表格具有下图所示的圆角: (现在不需要阴影,只需要圆角) 我已经尝试了一些代码,但似乎没有任何更改 unit UMainWindow; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type TFMainWi

我希望VCL表格具有下图所示的圆角:

(现在不需要阴影,只需要圆角)

我已经尝试了一些代码,但似乎没有任何更改

unit UMainWindow;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, 
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TFMainWindow = class(TForm)
  procedure FormCreate(Sender: TObject);
  end;

var
  FMainWindow: TFMainWindow;

implementation

procedure TFMainWindow.FormCreate(Sender: TObject);
var
  rgn: HRGN;
begin
  rgn := CreateRoundRectRgn(0, 0,ClientWidth,ClientHeight,40,40);
  SetWindowRgn(Handle, rgn, True);
end;

end.
这是我的结果:

我不知道您的设置窗口RGN为什么不工作。它是否返回0?OI中的任何非默认属性?
OnCreate
事件不是创建
HRGN
的最佳位置。替代虚拟
CreateWnd()
CreateWindowHandle()
方法。表单的
HWND
可以在
OnCreate
事件之后重新创建。此外,如果表单可调整大小,请使用
OnResize
事件为新维度重新创建
HRGN
。检查api调用是否存在错误非常重要。文档解释了它们是如何表示成功和失败的。@Matthias,我试过按原样在10.2 VCL上编写代码,它工作得很好。然而,在以前的版本中,我曾经遇到过一些问题,这些问题通过禁用StyleElemens的一些优先级(可能是seClient)来解决,但我不记得了。