C# GDI graphics.DrawImage 的參數問題


           graphics.DrawImage(imageSource,
                new System.Drawing.Point[] {
                                new System.Drawing.Point(1,1),
                                new System.Drawing.Point(3, 1),
                                new System.Drawing.Point(1, 3),
                        }
            );
            graphics.DrawImage(imageSource,
                new System.Drawing.Point[] {
                                new System.Drawing.Point(1,3),
                                new System.Drawing.Point(3, 3),
                                new System.Drawing.Point(1, 5),
                        }
            );

對於如上代碼,

傳入平行的點坐標,包含的點實際上每個都有3*3=9個點。

實際繪制的點只有 (2,2),(5,5) 兩個點

所以如果要繪制到(1,1)(1,2)兩個點需要這樣設置參數

            graphics.DrawImage(imageSource,
                 new System.Drawing.Point[] {
                                            new System.Drawing.Point(-1,-1),
                                            new System.Drawing.Point(1, -1),
                                            new System.Drawing.Point(-1, 1),
                         }
             );
            graphics.DrawImage(imageSource,
                new System.Drawing.Point[] {
                                    new System.Drawing.Point(-1,0),
                                    new System.Drawing.Point(1, 0),
                                    new System.Drawing.Point(-1, 2),
                        }
            );

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM