D7 窗体美化,想改变窗体的形状,求解……
想实现一个这样的对话框改怎么做呢
[最优解释]
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ExtCtrls, IdHTTP;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure ImageDbClick(Sender: TObject);
procedure ImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N1Click(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses dxGDIPlusClasses;//上面代码漏了引用这单元(DevExpress组件的单元)
procedure TForm1.FormCreate(Sender: TObject);
var ms:TMemoryStream;
idhttp:TIdhttp;
image:TImage;
PopupMenu1:TPopupMenu;
N1:TMenuItem;
begin
ms:=TMemoryStream.Create;
idhttp:=TIdhttp.Create(self);
try
idhttp.Get('http://attimg.dospy.com/img/day_101114/20101114_ccb5b082f312a7e41ce9ea7zIX377777.png',ms);
try
ms.Position:=0;
ms.SaveToFile('c:\tmp.png');
image:=TImage.Create(self);
try
image.Parent:=Form1;
image.Picture.LoadFromFile('c:\tmp.png');
image.AutoSize:=true;
image.OnDblClick:=ImageDbClick;
image.OnMouseDown:=ImageMouseDown;
AutoSize:=true;
Color:=clSkyBlue;
TransparentColor:=true;
TransparentColorValue:=clSkyBlue;
BorderStyle:=bsNone;
PopupMenu1:=TPopupMenu.Create(self);
N1:=TMenuItem.Create(PopupMenu1);
popupmenu1.Items.Add(N1);
N1.Caption:='关闭';
N1.OnClick:=N1Click;
PopupMenu:=PopupMenu1;
except
image.Free;
end;
finally
ms.Free;
end;
finally
idhttp.Free;
end;
end;
procedure TForm1.ImageDbClick(Sender: TObject);//响应双击
begin
showmessage('Hi');
end;
procedure TForm1.ImageMouseDown(Sender: TObject; Button: TMouseButton;//使窗体可拖动
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, $F012, 0);
end;
procedure TForm1.N1Click(Sender: TObject);//右键菜单
begin
Close;
end;
end.
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ExtCtrls, IdHTTP;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure ImageDbClick(Sender: TObject);
procedure ImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N1Click(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var ms:TMemoryStream;
idhttp:TIdhttp;
image:TImage;
PopupMenu1:TPopupMenu;
N1:TMenuItem;
begin
ms:=TMemoryStream.Create;
idhttp:=TIdhttp.Create(self);
try
idhttp.Get('http://attimg.dospy.com/img/day_101114/20101114_ccb5b082f312a7e41ce9ea7zIX377777.png',ms);
try
ms.Position:=0;
ms.SaveToFile('c:\tmp.png');
image:=TImage.Create(self);
try
image.Parent:=Form1;
image.Picture.LoadFromFile('c:\tmp.png');
image.AutoSize:=true;
image.OnDblClick:=ImageDbClick;
image.OnMouseDown:=ImageMouseDown;
AutoSize:=true;
Color:=clSkyBlue;
TransparentColor:=true;
TransparentColorValue:=clSkyBlue;
BorderStyle:=bsNone;
PopupMenu1:=TPopupMenu.Create(self);
N1:=TMenuItem.Create(PopupMenu1);
popupmenu1.Items.Add(N1);
N1.Caption:='关闭';
N1.OnClick:=N1Click;
PopupMenu:=PopupMenu1;
except
image.Free;
end;
finally
ms.Free;
end;
finally
idhttp.Free;
end;
end;
procedure TForm1.ImageDbClick(Sender: TObject);//响应双击
begin
showmessage('Hi');
end;
procedure TForm1.ImageMouseDown(Sender: TObject; Button: TMouseButton;//使窗体可拖动
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, $F012, 0);
end;
procedure TForm1.N1Click(Sender: TObject);//右键菜单
begin
Close;
end;
end.