本文实例讲述了C#实现在图像中绘制文字图形的方法。分享给大家供大家参考。具体实现方法如下:
usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Text; usingSystem.Windows.Forms; usingSystem.Drawing.Drawing2D; usingSystem.Drawing.Imaging; namespaceWindowsApplication2 { publicpartialclassForm20:Form { publicForm20() { InitializeComponent(); } privatevoidForm20_Load(objectsender,EventArgse) { } privatevoidbutton1_Click(objectsender,EventArgse) { Rectanglerect=newRectangle(0,0,100,100); Graphicsdg=this.CreateGraphics(); Imageimage=newBitmap(rect.Width,rect.Height,dg); Graphicsig=Graphics.FromImage(image); ig.FillRectangle(Brushes.Black,rect); Fontfont=newFont("Arial",12); Brushbrush=System.Drawing.Brushes.White; ig.DrawString("zhuzhao",font,brush,0,0); //ImageFormatiformat=newImageFormat(newGuid(Bmp)); image.Save(@"c:/image.png"); dg.DrawImage(image,newPointF(100,100)); } } }
希望本文所述对大家的C#程序设计有所帮助。
您可能感兴趣的文章:深入C#winform清除由GDI绘制出来的所有线条或图形的解决方法C#实现判断图形文件格式的方法c#图片处理之图片裁剪成不规则图形C#利用GDI绘制常见图形和文字C#使用Region对图形区域构造和填充的方法C#画笔Pen使用路径绘制图形的方法C#图形区域剪切的实现方法C#实现图形区域组合操作的方法使用C#编写简单的图形化的可发送附件的邮件客户端程序C#画笔Pen保存和恢复图形对象的设置方法C#编程调用Cards.dll实现图形化发牌功能示例
MFC串口通信发送16进制数据的方法
OpenCV使用鼠标响应裁剪图像
上述就是C#学习教程:C#实现在图像中绘制文字图形的方法分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/907276.html