procedure TScreenForm.ImageFullScreenDblClick(Sender: TObject);
var
pointArr:array of TPoint;
p :pNode;
i :integer;
polyRgn :HRGN;
w :integer;
h :integer;
xMin :integer;
xMax :integer;
yMin :integer;
yMax :integer;
bmp :TBitmap;
errCode :integer;
begin
if (dbClick=false) and (la^.dotCount>2) then begin
dbClick:=true;
with canvas do begin
MoveTo(FirstPoint.X,FirstPoint.Y);
LineTo(PastPoint.X,PastPoint.Y);
end;
setlength(pointArr,la^.dotCount);
p:=la^.next; for i:=0 to la^.dotCount-1 do begin
pointArr[i]:=p^.pos;
p:=p^.next;
end; xMin:=GetXMin(la);
xMax:=GetXMax(la);
yMin:=GetYMin(la);
yMax:=GetYMax(la);
w:=xMax-xMin;
h:=yMax-yMin; ClipBmp.Width:=w;
ClipBmp.Height:=h; bmp:=TBitmap.Create;
bmp.Width:=w;
bmp.Height:=h;
bmp.Canvas.CopyRect(Rect(0,0,bmp.Width,bmp.Height),
ImageFullScreen.Canvas,
Rect(xMin,yMin,xMax,yMax)); //就是这里polyRgn为0;
polyRgn:=CreatePolygonRgn(pointArr,la^.dotCount,WINDING);
errCode:=GetLastError();
SelectClipRgn(clipBmp.Canvas.Handle,polyRgn);
ClipBmp.Canvas.Draw(0,0,bmp); MainForm.ImagePreview.Picture.Bitmap:=ClipBmp;
MainForm.Show;
MainForm.PanelPreviewResize(Sender);
close; end;
end;
var
pointArr:array of TPoint;
p :pNode;
i :integer;
polyRgn :HRGN;
w :integer;
h :integer;
xMin :integer;
xMax :integer;
yMin :integer;
yMax :integer;
bmp :TBitmap;
errCode :integer;
begin
if (dbClick=false) and (la^.dotCount>2) then begin
dbClick:=true;
with canvas do begin
MoveTo(FirstPoint.X,FirstPoint.Y);
LineTo(PastPoint.X,PastPoint.Y);
end;
setlength(pointArr,la^.dotCount);
p:=la^.next; for i:=0 to la^.dotCount-1 do begin
pointArr[i]:=p^.pos;
p:=p^.next;
end; xMin:=GetXMin(la);
xMax:=GetXMax(la);
yMin:=GetYMin(la);
yMax:=GetYMax(la);
w:=xMax-xMin;
h:=yMax-yMin; ClipBmp.Width:=w;
ClipBmp.Height:=h; bmp:=TBitmap.Create;
bmp.Width:=w;
bmp.Height:=h;
bmp.Canvas.CopyRect(Rect(0,0,bmp.Width,bmp.Height),
ImageFullScreen.Canvas,
Rect(xMin,yMin,xMax,yMax)); //就是这里polyRgn为0;
polyRgn:=CreatePolygonRgn(pointArr,la^.dotCount,WINDING);
errCode:=GetLastError();
SelectClipRgn(clipBmp.Canvas.Handle,polyRgn);
ClipBmp.Canvas.Draw(0,0,bmp); MainForm.ImagePreview.Picture.Bitmap:=ClipBmp;
MainForm.Show;
MainForm.PanelPreviewResize(Sender);
close; end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货