delphi 实现异型窗体
想让窗体看起来有点新意,比如根据图片的样式形成窗体,或者形成其他好看点的窗体,有的人说用raize控件可以实现,知道怎样实现的麻烦稍微讲解下不要只是说什么可以实现什么可以...
想让窗体看起来有点新意,比如根据图片的样式形成窗体,或者形成其他好看点的窗体,有的人说用raize控件可以实现,知道怎样实现的麻烦稍微讲解下不要只是说什么可以实现什么可以实现。感激不尽...
展开
1个回答
展开全部
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
procedure WMEraseBkgnd(var m:TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMWinPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
public
{ Public declarations }
protected
procedure CreateParams(var Params: TCreateParams); Override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Brush.Style := bsClear;
BorderStyle := bsNone;
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;
procedure TForm1.WMEraseBkgnd(var m:TWMERASEBKGND);
begin
m.Result := LRESULT(false);
end;
procedure TForm1.WMWinPosChanging(var Message: TWMWindowPosChanging);
begin
Invalidate;
end;
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.WndParent := 0;
//把此窗口设为Desktop型的
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
ReleaseCapture;
SendMessage(Handle, WM_SYSCOMMAND, SC_MOVE or HTCLIENT, 0);
self.hide;
self.Show;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
procedure WMEraseBkgnd(var m:TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMWinPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
public
{ Public declarations }
protected
procedure CreateParams(var Params: TCreateParams); Override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Brush.Style := bsClear;
BorderStyle := bsNone;
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;
procedure TForm1.WMEraseBkgnd(var m:TWMERASEBKGND);
begin
m.Result := LRESULT(false);
end;
procedure TForm1.WMWinPosChanging(var Message: TWMWindowPosChanging);
begin
Invalidate;
end;
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.WndParent := 0;
//把此窗口设为Desktop型的
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
ReleaseCapture;
SendMessage(Handle, WM_SYSCOMMAND, SC_MOVE or HTCLIENT, 0);
self.hide;
self.Show;
end;
end;
end.
上海华然企业咨询
2024-10-21 广告
2024-10-21 广告
上海华然企业咨询有限公司专注于AI与数据合规咨询服务。我们的核心团队来自头部互联网企业、红圈律所和专业安全服务机构。凭借深刻的AI产品理解、上百个AI产品的合规咨询和算法备案经验,为客户提供专业的算法备案、AI安全评估、数据出境等合规服务,...
点击进入详情页
本回答由上海华然企业咨询提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询