delphi 的窗體透明.. 我 有 一 張 圖片..不規則的...我想讓它只顯示不規則圖片.. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用 1stclass 控件组吧,很方便,用TfcImage控件 airhorse(编程至尊宝) :能具體一點嗎.. Kingron(WinAPI) ;能具體一點嗎.. coldljy(凤舞N天):窗體的背景色還在 呀.... Venus控件组中,有一个oxForms控件,只要放上一个不规则图片(.bmp),马上变成不规则窗体,一句代码都不用写,很酷的。 :) 也许下面两个属性设置对你有所帮助的,该窗体的刷新问题可不是好解决的了:1. Form1.Brush.Style:= bsClear2. Form1.BorderStyle:= bsNone 去下载一个叫 1stclass 的界面增强控件,还有infopower数据库增强控件。很管用的。 我有注册码。 在窗体的 Create 中加上: SetWindowLong(窗体名.Handle,GWL_EXSTYLE,WS_EX_TRANSPARENT); 我来贴一段代码!你去试一试!!很管用的哦,真正的透明!Procedure TForm1.FormCreate (Sender: TObject);VarFullRgn, ClientRgn, ButtonRgn: THandle;LeftMargin, TopMargin, Margin, X, i: integer;Begin Margin: = (Width - ClientWidth) div 2; FullRgn: = CreateRectRgn (0, 0, Width, Height); LeftMargin: = Margin; TopMargin: = Height - ClientHeight - Margin; ClientRgn: = CreateRectRgn (LeftMargin, TopMargin, LeftMargin + ClientWidth, TopMargin + ClientHeight); CombineRgn (FullRgn, FullRgn, ClientRgn, RGN_DIFF); For i: = 0 to ComponentCount-1 do Begin If not (Components [i] is TWinControl) then continue; If (Components [i] as TWinControl). Parent<>self then continue; X: = LeftMargin + (Components [i] as TWinControl). Left; Y: = TopMargin + (Components [i] as TWinControl). Top; ButtonRgn: = CreateRectRgn (X, Y, X + (Components [i] as TWinControl). Width, Y + (Components [i] as TWinControl). Height); CombineRgn (FullRgn, FullRgn, ButtonRgn, RGN_OR); End;SetWindowRgn (Handle, FullRgn, True);End; 用 this.Brush.Style := bsClear 试试;在CB中我可成功乐的! 1 在FromCreate Canvas.Brush.Style:=bsClear;2 重载 CreateParams方法; Inherit CREATEPARAMS(PARAMS); 调API!!选择一个Region,然后把窗口边缘设为这个Region coolform也可以。不过我反对控件主义。这点应该可以用Mask搞定吧。 rehuo(热火) :不行呀...我看不到圖片了...... rehuo(热火) :是 這樣的...案你的方法可以..不過我打開別的窗口就 會有背景出現...如;我打開word..再關掉word..圖片就 會有背景出現..... 试试我的代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, Buttons;type TForm1 = class(TForm) Image1: TImage; Button1: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private function CreateRegion(wMask: TBitmap; wColor: TColor; hControl: THandle): HRGN; { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}function Tform1.CreateRegion(wMask:TBitmap;wColor:TColor;hControl:THandle): HRGN;var dc, dc_c: HDC; rgn: HRGN; x, y: integer; coord: TPoint; line: boolean; color: TColor;begin dc := GetWindowDC(hControl); dc_c := CreateCompatibleDC(dc); SelectObject(dc_c, wMask.Handle); BeginPath(dc); for x:=0 to wMask.Width-1 do begin line := false; for y:=0 to wMask.Height-1 do begin color := GetPixel(dc_c, x, y); if not (color = wColor) then begin if not line then begin line := true; coord.x := x; coord.y := y; end; end; if (color = wColor) or (y=wMask.Height-1) then begin if line then begin line := false; MoveToEx(dc, coord.x, coord.y, nil); LineTo(dc, coord.x, y); LineTo(dc, coord.x + 1, y); LineTo(dc, coord.x + 1, coord.y); CloseFigure(dc); end; end; end; end; EndPath(dc); rgn := PathToRegion(dc); ReleaseDC(hControl, dc); Result := rgn;end;procedure TForm1.FormCreate(Sender: TObject);var w1:TBitmap; w2:TColor; rgn: HRGN;begin w1:=TBitmap.Create; w1.Assign(image1.Picture.Bitmap); w2:=w1.Canvas.Pixels[0,0]; rgn := CreateRegion(w1,w2,Handle); if rgn<>0 then begin SetWindowRgn(Handle, rgn, true); end; w1.Free;end;procedure TForm1.Button1Click(Sender: TObject);begin Close;end;procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin ReleaseCapture; SendMessage(Handle, WM_SYSCOMMAND, $F012, 0);end;end. 怎么动态获得当前时间? 关于TTable.Locate() 用ellipse画圆,半径较小出来的效果一点都不圆。怎办?急! 一运行就死,郁闷! 关于在delphi前台执行Transact-SQL的问题,高手请进!!! richedit 保存到数据库,但是我错了 MidStr不能用,为什么 我真的期待DELPHI击败其他的开发工具,特别是微软的! 谁能给我一份详细的installshield得说明,最好能有个列程。给分 不规则窗体(具体说是像一本打开的书一样) 请问一下在Delphi中字符大小写转换的函数是什么? 菜鸟问题----OleVariant类型的使用
能具體一點嗎..
能具體一點嗎..
窗體的背景色還在 呀....
1. Form1.Brush.Style:= bsClear
2. Form1.BorderStyle:= bsNone
我有注册码。
SetWindowLong(窗体名.Handle,GWL_EXSTYLE,WS_EX_TRANSPARENT);
你去试一试!!很管用的哦,真正的透明!
Procedure TForm1.FormCreate (Sender: TObject);
Var
FullRgn, ClientRgn, ButtonRgn: THandle;
LeftMargin, TopMargin, Margin, X, i: integer;
Begin
Margin: = (Width - ClientWidth) div 2;
FullRgn: = CreateRectRgn (0, 0, Width, Height);
LeftMargin: = Margin;
TopMargin: = Height - ClientHeight - Margin;
ClientRgn: = CreateRectRgn (LeftMargin, TopMargin, LeftMargin + ClientWidth, TopMargin + ClientHeight);
CombineRgn (FullRgn, FullRgn, ClientRgn, RGN_DIFF);
For i: = 0 to ComponentCount-1 do
Begin
If not (Components [i] is TWinControl) then continue;
If (Components [i] as TWinControl). Parent<>self then continue;
X: = LeftMargin + (Components [i] as TWinControl). Left;
Y: = TopMargin + (Components [i] as TWinControl). Top;
ButtonRgn: = CreateRectRgn (X, Y, X + (Components [i] as TWinControl). Width, Y + (Components [i] as TWinControl). Height);
CombineRgn (FullRgn, FullRgn, ButtonRgn, RGN_OR);
End;
SetWindowRgn (Handle, FullRgn, True);
End;
在CB中我可成功乐的!
Canvas.Brush.Style:=bsClear;
2 重载 CreateParams方法;
Inherit CREATEPARAMS(PARAMS);
这点应该可以用Mask搞定吧。
不行呀...
我看不到圖片了......
是 這樣的...
案你的方法可以..不過我打開別的窗口就 會有背景出現...
如;我打開word..再關掉word..圖片就 會有背景出現.....
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons;type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
function CreateRegion(wMask: TBitmap; wColor: TColor;
hControl: THandle): HRGN;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}function Tform1.CreateRegion(wMask:TBitmap;wColor:TColor;hControl:THandle): HRGN;
var
dc, dc_c: HDC;
rgn: HRGN;
x, y: integer;
coord: TPoint;
line: boolean;
color: TColor;
begin
dc := GetWindowDC(hControl);
dc_c := CreateCompatibleDC(dc);
SelectObject(dc_c, wMask.Handle);
BeginPath(dc);
for x:=0 to wMask.Width-1 do
begin
line := false;
for y:=0 to wMask.Height-1 do
begin
color := GetPixel(dc_c, x, y);
if not (color = wColor) then
begin
if not line then
begin
line := true;
coord.x := x;
coord.y := y;
end;
end;
if (color = wColor) or (y=wMask.Height-1) then
begin
if line then
begin
line := false;
MoveToEx(dc, coord.x, coord.y, nil);
LineTo(dc, coord.x, y);
LineTo(dc, coord.x + 1, y);
LineTo(dc, coord.x + 1, coord.y);
CloseFigure(dc);
end;
end;
end;
end;
EndPath(dc);
rgn := PathToRegion(dc);
ReleaseDC(hControl, dc);
Result := rgn;
end;procedure TForm1.FormCreate(Sender: TObject);
var
w1:TBitmap;
w2:TColor;
rgn: HRGN;
begin
w1:=TBitmap.Create;
w1.Assign(image1.Picture.Bitmap);
w2:=w1.Canvas.Pixels[0,0];
rgn := CreateRegion(w1,w2,Handle);
if rgn<>0 then
begin
SetWindowRgn(Handle, rgn, true);
end;
w1.Free;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Handle, WM_SYSCOMMAND, $F012, 0);
end;end.