全透,那不和没有一样了么其实是WIN2000下,有一个函数的,
有前面?
showwindow的一个选项而已如在98上,
只有自己算一下了,
有前面?
showwindow的一个选项而已如在98上,
只有自己算一下了,
解决方案 »
- DevExpress VCL使用问题
- 1.如何通过DELPHI代码把IE设置为默认浏览器? 2,WebBrowser.OleObject.document.links.item(i).Click ,单击后IE显示问题?
- 组件为什么装不上去?
- 如何捕获 (声明) DataSource.DataSet 中的 BeforePost 等事件?(特急)
- 做成商业软件,发布时需要做什么?
- 有好看的XP控件吗,在哪可以下载?像金山毒霸那样的
- 主从表的问题。求助!来者给分!
- 这个效果怎做,根是几个部门,根下是某一部门的人员名,点人员名,在grid中显示相应的
- 关于TEdit控件,当它得到焦点的时候我怎么知道现在光标停在第几个字符后面?
- 数据库多线程写操作,怎么实现事务功能?
- 在delphi中怎样使非主窗体总在桌面的最前端
- 我控制面板中的程序有些卸载不了啦。怎么办
unit Unit1; interface uses
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.
你的代码是不是没给完?
function Tform1.CreateRegion(wMask:TBitmap;wColor:TColor;hControl:THandle)
涵树声明了却没用!
在public中加procedure createparams(var params:tcreateparams);override;implementation
procedure Tform1.createparams(var params:tcreateparams);
begin
inherited createparams(params);
With Params do
begin
EXStyle:=ExStyle or WS_EX_TOPMOST OR WS_EX_ACCEPTFILES or WS_DLGFRAME;
wndParent:=GetDesktopWindow;
end;
end;