c# Graphics使用方法(畫圓寫字代碼)


畫填充圓:     

Graphics gra = this.pictureBox1.CreateGraphics();
gra.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Brush bush = new SolidBrush(Color.Green);//填充的顏色
gra.FillEllipse(bush, 10, 10, 100, 100);//畫填充橢圓的方法,x坐標、y坐標、寬、高,如果是100,則半徑為50

畫圓圈

Graphics gra = this.pictureBox1.CreateGraphics();
gra.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen pen = new Pen(Color.Pink);//畫筆顏色                                
gra.DrawEllipse(pen, 250, 10, 100, 100);//畫橢圓的方法,x坐標、y坐標、寬、高,如果是100,則半徑為50

寫字

Graphics gra = this.pictureBox1.CreateGraphics();
Font myFont = new Font("宋體", 60, FontStyle.Bold);
Brush bush = new SolidBrush(Color.Red);//填充的顏色
gra.DrawString("腳本之家!", myFont, bush, 100, 100);

 


免責聲明!

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



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