1. 程式人生 > >利用C 製作公章

利用C 製作公章

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow

也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!

               

先看一下效果圖:

程式碼:
private void button1_Click(object sender, System.EventArgs e)
  {
   Graphics g = this.CreateGraphics();
   g.Clear(Color.White);
   //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
   g.CompositingQuality = CompositingQuality.HighQuality;
   g.SmoothingMode = SmoothingMode.HighQuality;
           
   int radius = 200;
   CircularTextualLayout ctl = new CircularTextualLayout();
   ctl.Radius = radius;
   Point location = new Point(50, 20);
   //ctl.CenterPoint = new Point(location.X + radius, location.Y + radius);
   ctl.TextDrawing = "方正姚體方正姚體方正姚體方正姚體";

   float arcAngle = 270;
   ctl.ArcAngle = arcAngle;
   ctl.AngleStart = -arcAngle/2 + arcAngle/2/ctl.TextDrawing.Length;
   ctl.TextFontInner = new Font("方正姚體", radius/3.2f);
   ctl.RatioX = 0.6f;
   ctl.BorderWidth = (int)(ctl.Radius / 40);
   //ctl.IsBold = false;
   ctl.Location = location;
   ctl.WordsColor = Color.FromArgb(250, Color.Red);
   ctl.BorderColor = Color.FromArgb(250, Color.Red);
   ctl.RectColor = Color.FromArgb(250, Color.Red);
   ctl.Draw(g);

   g.Dispose();
  }

公章樣式的水印圖片(截圖):

公章樣式的水印圖片效果


  private void button2_Click(object sender, System.EventArgs e)
  {
   Graphics g = this.CreateGraphics();
   g.Clear(Color.White);
   //g.DrawImage(Image.FromFile(@"F:/imgs/girl/227.jpg"), 0, 0);
   g.DrawImage(Image.FromFile(@"D:/JohnsunTest/aa/05290_b11.jpg"), 0, 0);
   //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
   g.CompositingQuality = CompositingQuality.HighQuality;
   g.SmoothingMode = SmoothingMode.HighQuality;
           
   int radius = 100;
   int offset = 1;
   CircularTextualLayout ctl = new CircularTextualLayout();
   ctl.Radius = radius;
   Point location = new Point(500, 100);
   //ctl.CenterPoint = new Point(location.X + radius, location.Y + radius);
   ctl.TextDrawing = "公章樣式之水印圖片製作";

   float arcAngle = 270;
   //ctl.AngleStart = -105+ 210/ctl.TextDrawing.Length/2;
   ctl.ArcAngle = arcAngle;
   //ctl.AngleStart = (arcAngle/2) * ( - 1 + 1/ctl.TextDrawing.Length);
   ctl.AngleStart = -arcAngle/2 + arcAngle/2/ctl.TextDrawing.Length;
   //ctl.TextFontInner = new Font("方正小篆體", 56f);
   ctl.TextFontInner = new Font("方正姚體", radius/3.2f);
   ctl.RatioX = 0.6f;
   ctl.BorderWidth = (int)(ctl.Radius / 40);
   //ctl.IsBold = false;
   ctl.Location = location;
   ctl.WordsColor = Color.FromArgb(160, Color.Black);
   ctl.BorderColor = Color.FromArgb(160, Color.Black);
   ctl.RectColor = Color.FromArgb(160, Color.Black);
   ctl.Draw(g);

   location.Offset(-offset*2, -offset*2);
   ctl.Location = location;
   ctl.WordsColor = Color.FromArgb(160, Color.White);
   ctl.BorderColor = Color.FromArgb(60, Color.White);
   ctl.RectColor = Color.FromArgb(160, Color.White);
   ctl.Draw(g);

   g.Dispose();
  }

相關連結:
利用C#製作公章(續)  http://blog.csdn.net/johnsuna/archive/2006/03/23/635989.aspx
在WPF中製作正圓形公章 http://blog.csdn.net/johnsuna/archive/2007/10/12/1821531.aspx

後續WPF版本:
WPF正圓形公章製作之2
  (http://blog.csdn.net/johnsuna/archive/2008/04/28/2336495.aspx

           

給我老師的人工智慧教程打call!http://blog.csdn.net/jiangjunshow

這裡寫圖片描述