J
jqw
Unregistered / Unconfirmed
GUEST, unregistred user!
各位兄弟:<br><br> 我在Delphi4+NT下调用Windows API函数Polygon,但就是<br>画不出多边形来,这是为什么?请各位大吓帮忙。<br><br> 下面是部分程序:<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> //<br> DC:HDC;<br> brush:HBRUSH;<br> PEN:HPEn;<br> oldmode:integer;<br> //<br> PointsArr:Array of TPoint;<br>begin<br> DC:=GetDC(Handle);//换成 DC:=Canvas.Handle 也不灵<br> brush:=0;<br> pen:=0;<br> //<br><br> try<br> brush:=CreateSolidBrush(Clred);<br> oldMode:=SetBkMode(DC,Transparent);//<br> SelectObject(DC,brush);<br><br> Pen:=CreatePen(PS_SOLID,1,clred);<br> SelectObject(DC,Pen);<br><br> SetLength(PointsArr,4);//<br><br> PointsArr[0]:=Point(20,2);<br> PointsArr[1]:=Point(120,6);<br> PointsArr[2]:=Point(100,200);<br> PointsArr[3]:=Point(20,200);<br><br> Windows.Polygon(DC,PointsArr, 4); //??<br> finally<br> DeleteObject(brush);<br> DeleteObject(PEN);<br> end;<br><br> SetBkMode(DC,oldMode);//<br>end;<br><br> 多谢!!<br>