利用C#制作公章

先看一下效果图:

代码:
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();
  }



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=622836

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
利用C#编曲需要使用音乐编程库或软件,例如NAudio或CSCore。这些库可以让你创建和处理音频文件,包括合成和编辑音乐。以下是一个简单的C#编曲示例: ```csharp using NAudio.Wave; // 创建一个音频输出设备 IWavePlayer waveOutDevice = new WaveOut(); // 创建一个音频流 WaveFormat waveFormat = new WaveFormat(44100, 2); WaveFileWriter waveFileWriter = new WaveFileWriter("output.wav", waveFormat); // 创建一个简单的音符序列 double[] frequencies = {261.63, 293.66, 329.63, 349.23, 392.00, 440.00, 493.88}; double duration = 0.5; double amplitude = 0.25; // 合成音乐 foreach (double frequency in frequencies) { double[] waveform = new double[(int)(waveFormat.SampleRate * duration)]; for (int i = 0; i < waveform.Length; i++) { double time = (double)i / waveFormat.SampleRate; waveform[i] = amplitude * Math.Sin(2 * Math.PI * frequency * time); } byte[] buffer = new byte[waveform.Length * 2]; Buffer.BlockCopy(waveform, 0, buffer, 0, buffer.Length); waveFileWriter.Write(buffer, 0, buffer.Length); } // 播放音乐 WaveFileReader waveFileReader = new WaveFileReader("output.wav"); waveOutDevice.Init(waveFileReader); waveOutDevice.Play(); ``` 这个示例创建一个音频输出设备和一个音频流,然后使用一些简单的数学函数合成了一些音符,并将它们写入音频流中。最后,它使用音频输出设备播放音乐。你可以根据需要进行修改和扩展,以实现各种不同类型的音乐编曲。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值