【VS2010 C# 代码】截屏并且写上文字做成图片输出

时间:2020-10-06 07:58:51
【文件属性】:

文件名称:【VS2010 C# 代码】截屏并且写上文字做成图片输出

文件大小:43KB

文件格式:RAR

更新时间:2020-10-06 07:58:51

VS2010 截屏 文字 图片

Microsoft Visual Studio 2010做的C#截屏并且写上文字做成图片输出实例,主要代码: Bitmap bitmapScreen = new Bitmap(iScreenWidth, iScreenHeight); Bitmap bitmapOut = new Bitmap(600, 200); Graphics graOut = Graphics.FromImage(bitmapOut); //创建画笔 graOut.FillRectangle(Brushes.White, new Rectangle(0, 0, 600, 600)); //把b1涂成白色 Font fontText = new Font("宋体", 8); SolidBrush sbhText = new SolidBrush(Color.Black); graOut.DrawString(sText, fontText, sbhText, new PointF(0, 0)); SizeF sizefText = graOut.MeasureString(sText, fontText); int iTextWidth = Convert.ToInt32( sizefText.Width); int iTextHeight = Convert.ToInt32( sizefText.Height); graOut.CopyFromScreen(new Point(iBeginX, iBeginY), new Point(iTextWidth, 0), bitmapScreen.Size);//截屏 bitmapOut.Save("D:\\temp\\temp0907.png", System.Drawing.Imaging.ImageFormat.Png); graOut.Dispose(); bitmapOut.Dispose();


【文件预览】:
Demo_createTextImage
----Demo_createTextImage()
--------bin()
--------Demo_createTextImage.csproj(4KB)
--------w_main.Designer.cs(3KB)
--------obj()
--------Properties()
--------Program.cs(502B)
--------w_main.resx(6KB)
--------w_main.cs(2KB)
----Demo_createTextImage.sln(902B)
----Demo_createTextImage.suo(20KB)

网友评论