0
我使用Win API调用(多边形)在Delphi中使用可选孔填充填充区域。通过裁剪区域来切割孔(不填充bg颜色)。它可以正常工作,直到我打印预览(并且打印预览看起来很好,直到预览页面不包含带孔的填充区域)。打印预览中的页面内容由填充区域的相同方法调用绘制,就在调用在dc上设置的纸张尺寸缩放和裁剪区域之前。填充区域对象的绘制方法不会将自己的裁剪操作与页面裁剪相结合。如何才能在页面切割夹和其他切割夹之间进行AND操作(切割孔应该是彼此相关的)。如何在主剪切区域和其他剪切区域之间进行“与”运算?
的FilledArea对象绘制方法(只是裁剪特定行):
...
try
if (fHoles^.getCount > 0) then
begin
// Get a copy of the page clipping rgn
getClipRgn(dc, rgnPrev);
for i := 0 to fHoles^.getCount-1 do
begin
...
// create a rgn to the Xth hole
rgn := createPolygonRgn(rgnPts^, rgnPtsCount, ALTERNATE);
if (rgn <> 0) then
begin
// combine the Xth rgn with the active rgn (OR because there could be many holes in a single filled area)
extSelectClipRgn(dc, rgn, RGN_DIFF);
// releases the Xth rgn
deleteObject(rgn);
end;
...
end;
end;
// draw the polygon
finally
if (fHoles^.getCount > 0) then
begin
// selects a copy of the page cutting rgn copy
selectClipRgn(dc, rgnPrev);
// releases the copy of the page cutting rgn
deleteObject(rgnPrev);
end;
end;
打印预览裁剪区域的绘图代码:
// Creates a page clipping rgn
rcRegion := createRectRgn(rcDevLeft_, rcDevTop_, rcDevRight_ + 2, rcDevBottom_ + 2);
try
// Selects a copy of the page clipping rgn
selectClipRgn(dc_, rcRegion);
...
// draw the page contents
...
finally
// Selects an empty clipping rgn
selectClipRgn(dc_, 0);
// Releases the created page clipping rgn
deleteObject(rcRegion);
end;
打印预览屏幕截图从同一设计(移动的轮廓线标志着第e页面切割区域被忽略,内容由于两页而被两次绘制)
这是无法理解的。 –
@SertacAkyuz你不了解什么? –
你在做什么。演示图形可以很好。然后你可能还需要一个[MCVE]。 –