我 有 一 張 圖片..不規則的...
我想讓它只顯示不規則圖片..
我想讓它只顯示不規則圖片..
解决方案 »
- 用D7设计出可发送带附件的邮件。
- 我的网站 www.31qq.com 请大家看看去 顶者有分!!!!!!!!
- 急啊,到底有没有人会啊
- 是不是execsql之前的SQL语句不能带参数?
- 请教高手,如何利用listbox实现类似于memo的水平滚动条?
- 求一sql语句
- 一条SQL 语句的效率问题!(大家来捧捧场,顺便拿点分回去啊!)
- 十万火急!!谁知道那有 英汉对照翻译的电脑方面的资料!!!(一定给50)分
- 做计算器时,怎样写+、-、*、/的代码,写在哪个按扭里。请大家帮忙!
- 关于delphi中dbgrid的问题
- 请问一下在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.