C#环境中 OWC 怎么设置字体啊,还有做好的图怎么加字!用什么类的什么的方法来修改GIF图片哦,我想加字在上面

解决方案 »

  1.   

    给图像添加文字
    摘录:《程序员秘书》--源代码--图像处理--给图像添加版权
    轻松开发软件,详见:http://www.psec.net.cn给图像添加版权信息:一种是直接打有颜色的字,另一种是打字的颜色为原图像颜色的加亮色,并带有阴影效果。
    第一种代码如下:
    private void button2_Click(object sender, EventArgs e)
    {
        button2.Enabled = false;
        try
        {
            Image ImageTemp = pictureBox1.Image;//获取原始图像
            Bitmap BitMap = new Bitmap(ImageTemp.Width, ImageTemp.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); //创建一张与原始图像相同大小的位图
            Graphics G = Graphics.FromImage(BitMap); //根据位图获取画布
            G.Clear(Color.Transparent); //清空画布并用透明色填充
            G.DrawImage(ImageTemp, 0, 0, ImageTemp.Width, ImageTemp.Height); //将一幅原始图像画到画布上
            G.DrawString("程序员秘书!", new Font("黑体", 15), new SolidBrush(Color.Red), new Rectangle(20, 100, 300, 100)); //写版权信息到图像上,字在图像的(20,100)、宽和高要大于字符串的宽和高才能显示。
            pictureBox2.Image = BitMap; //显示添加了版权信息的图像
            //添加了版权信息的图像保存到文件
            SaveFileDialog SaveFileDialog1 = new SaveFileDialog();
            SaveFileDialog1.Title = "图象保存为";
            SaveFileDialog1.Filter = "Bitmap文件(*.bmp)| *.bmp";
            if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                BitMap.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp); //保存图片
                MessageBox.Show("添加版权信息的图像已保存!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        catch (Exception Mye)
        {
            MessageBox.Show(Mye.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        button2.Enabled = true;
    }
      

  2.   

    呵呵,从来没有弄过,好了都搞定了,谢谢 cq_lqj(程序员秘书)  抛砖