熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> ASP編程 >> 正文

c#畫三角形,並填充顏色

2022-06-13   來源: ASP編程 

  目前知道有兩種方法畫多邊形GraphicsPath但是用畫多邊形的方式畫三角形不太好老畫不正的截圖放大就明顯了

  代碼

       Point point = new Point( );

       Point point = new Point( );

       Point point = new Point( );

       Point[] pntArr = {point point point};

  

       eGraphicsFillPolygon(BrushesRed pntArr);

  代碼

                   int len = ;

                   int x = ;

                   int y = ;

                   Point[] pntArr = new Point[];

                   pntArr[] = new Point(x y);

                   pntArr[] = new Point(x len y);

                   pntArr[] = new Point(x len / (int)(len * MathSqrt() / + y));

                   GraphicsPath path = new GraphicsPath();

                   pathAddLines(pntArr);

                   eGraphicsSmoothingMode = SystemDrawingDrawingDSmoothingModeAntiAlias;

                   eGraphicsFillPath(BrushesRed path);

                   eGraphicsSmoothingMode = SystemDrawingDrawingDSmoothingModeDefault;


From:http://tw.wingwit.com/Article/program/ASP/201311/21782.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.