怎样做到窗体的切入切出以及半透明窗体? API:ANIMATTEWINDOW();d6的FORM直接有ALPHABLEND不过只有在WIN2000下才有用! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 半透明代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Buttons;type TForm1 = class(TForm) Label1: TLabel; Shape1: TShape; Shape2: TShape; Shape3: TShape; Shape4: TShape; Image1: TImage; SpeedButton1: TSpeedButton; procedure FormCreate(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); private { Private declarations } //截获背景图象 function GetBackgroundBmp:TBitmap; //对背景图象进行滤镜处理procedure TranslucentBmp(Bmp:TBitmap;AColor:TColor;ATransparent:Longint); public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}//以下截获背景图象function TForm1.GetBackgroundBmp:TBitmap;var Scn:TCanvas; h,w:Integer;beginScn:=TCanvas.Create; //建立整个屏幕的画布h:=ClientHeight;//窗口的高w:=ClientWidth; //窗口的宽Result.Height:=h; //设返回位图的高就是窗口的高Result.Width:=w;//设返回位图的宽就是窗口的宽tryScn.Handle:=GetDC(0);//取得整个屏幕的DC//以下一行将窗口的背景部分复制到指定的画布中,也就是本函数的返回值Result.Canvas.CopyRect(Rect(0,0,w,h),Scn,Rect(Left,Top,Left+w,Top+h));ReleaseDC(0, Scn.handle);finallyScn.Free;end;end;//以下函数对背景图象进行滤镜处理,Bmp是要处理的位图;ATransparent是透明度procedure TForm1.TranslucentBmp(Bmp:TBitmap;AColor:TColor;ATransparent:Longint);var BkColor:COLORREF; ForeColor:Longint; R,G,B:Int64; i,j:Integer;beginForeColor:=ColorToRGB(AColor);with Bmp.Canvas dofor i:=ClientHeight-1 downto 0 do for j:=ClientWidth-1 downto 0 do begin BkColor:=GetPixel(Handle,j,i); //取得每一象素 R:=Byte(ForeColor)+(Byte(BkColor)-Byte(ForeColor))*ATransparent; G:=Byte(ForeColor shr 8)+(Byte(BkColor shr 8)-Byte(ForeColor shr 8))*ATransparent; B:=Byte(ForeColor shr 16)+(Byte(BkColor shr 16)-Byte(ForeColor shr 16))*ATransparent; SetPixelV(Handle,j,i,RGB(R,G,B));//合成象素 end;end;procedure TForm1.FormCreate(Sender: TObject);var BackgroundBmp:TBitmap;begintryBackgroundBmp:=Tbitmap.Create; //建立窗口背景图BackgroundBmp.PixelFormat:=pf24bit; //指定该图是24位真彩色BackgroundBmp:=GetBackgroundBmp;//取得窗口背景图TranslucentBmp(BackgroundBmp,clBlack,50);//对该图象进行滤镜处理Image1.Picture.Bitmap:=BackgroundBmp;//将处理过的图象显示出来finallyBackgroundBmp.Free;end;end;procedure TForm1.SpeedButton1Click(Sender: TObject);beginClose;end;end. animatewindow()参数看帮助吧!很方便的。 idhttp socket error #10060出现这错误 [delphi indy]indy 9 中的控件如何转换到indy 10中使用? 如何把数据库若干字段显示到txt文本中? 发往国外的短信实现 怎样用鼠标拷贝一些不给拷贝的页面?----在线等! 一个简单的问题,如何显示进度? 请问:这类问题学vc好还是学dephi好? 请问大家,怎样使用jpg图像文件? delphi中的CASE语句问题 请问如何用鼠标画一个椭圆? 用shellexecute如何打开一个exe文件???? 在字符串中查找另一个字符串的位置,DELPHI的函数是什么?
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons;type
TForm1 = class(TForm)
Label1: TLabel;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Image1: TImage;
SpeedButton1: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
//截获背景图象
function GetBackgroundBmp:TBitmap;
//对背景图象进行滤镜处理
procedure TranslucentBmp(Bmp:TBitmap;
AColor:TColor;ATransparent:Longint);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
//以下截获背景图象
function TForm1.GetBackgroundBmp:TBitmap;
var Scn:TCanvas;
h,w:Integer;
begin
Scn:=TCanvas.Create; //建立整个屏幕的画布
h:=ClientHeight;//窗口的高
w:=ClientWidth; //窗口的宽
Result.Height:=h; //设返回位图的高就是窗口的高
Result.Width:=w;//设返回位图的宽就是窗口的宽
try
Scn.Handle:=GetDC(0);//取得整个屏幕的DC
//以下一行将窗口的背景部分复制到指定的画布中,
也就是本函数的返回值
Result.Canvas.CopyRect(Rect(0,0,w,h),Scn,
Rect(Left,Top,Left+w,Top+h));
ReleaseDC(0, Scn.handle);
finally
Scn.Free;
end;
end;//以下函数对背景图象进行滤镜处理,
Bmp是要处理的位图;ATransparent是透明度
procedure TForm1.TranslucentBmp(Bmp:
TBitmap;AColor:TColor;ATransparent:Longint);
var BkColor:COLORREF;
ForeColor:Longint;
R,G,B:Int64;
i,j:Integer;
begin
ForeColor:=ColorToRGB(AColor);
with Bmp.Canvas do
for i:=ClientHeight-1 downto 0 do
for j:=ClientWidth-1 downto 0 do
begin
BkColor:=GetPixel(Handle,j,i); //取得每一象素
R:=Byte(ForeColor)+
(Byte(BkColor)-Byte(ForeColor))*ATransparent;
G:=Byte(ForeColor shr 8)+
(Byte(BkColor shr 8)-Byte(ForeColor
shr 8))*ATransparent;
B:=Byte(ForeColor shr 16)+
(Byte(BkColor shr 16)-Byte(ForeColor
shr 16))*ATransparent;
SetPixelV(Handle,j,i,RGB(R,G,B));//合成象素
end;
end;procedure TForm1.FormCreate(Sender: TObject);
var BackgroundBmp:TBitmap;
begin
try
BackgroundBmp:=Tbitmap.Create;
//建立窗口背景图
BackgroundBmp.PixelFormat:=pf24bit;
//指定该图是24位真彩色
BackgroundBmp:=GetBackgroundBmp;
//取得窗口背景图
TranslucentBmp(BackgroundBmp,clBlack,50);
//对该图象进行滤镜处理
Image1.Picture.Bitmap:=BackgroundBmp;
//将处理过的图象显示出来
finally
BackgroundBmp.Free;
end;
end;procedure TForm1.SpeedButton1Click
(Sender: TObject);
begin
Close;
end;end.
参数看帮助吧!很方便的。