1,183
社区成员
发帖
与我相关
我的任务
分享
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses GDIPOBJ,GDIPAPI;
{$R *.dfm}
var
OldWinProc: integer;
g_hdc: HDC;
g_hWnd: HWND;
function WinProc(Hwnd,Msg,wParam,lParam:longint):LRESULT;Stdcall;
var
g: TGPGraphics;
img: TGPImage;
ps: tagPAINTSTRUCT;
begin
case Msg of
WM_LBUTTONDBLCLK:
ShowMessage('DoubleClick!');
WM_PAINT:
begin
BeginPaint(g_hWnd,ps);
g := TGPGraphics.Create(g_hdc);
img := TGPImage.Create(ExtractFilePath(ParamStr(0)) + '背景图片.jpg');
g.DrawImage(img,0,0);
img.Free;
g.Free;
EndPaint(g_hWnd,ps);
end;
end;
result := CallWindowProc(pointer(OldWinProc),Hwnd,Msg,wParam,lParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
g_hdc := Self.Canvas.Handle;
g_hWnd := Self.Handle;
OldWinProc := SetWindowLong(Self.Handle,GWL_WNDPROC,Integer(@WinProc))
end;
end.