vb.net画直线不消失,将图形保存为bmp文件

vb.net画直线不消失,将图形保存为bmp文件,第1张

概述须创建bitmap,关联到picturebox1.image上。 再在picturebox1.image上创建Graphics,再进行作图。 注意,因picturebox1.image是最初bitmap创建,默认是黑色,故,须用fillrectangle把背景刷成白色。 Imports System.DrawingImports System.Drawing.Drawing2DPublic C


须创建bitmap,关联到pictureBox1.image上。

再在pictureBox1.image上创建Graphics,再进行作图。


注意,因pictureBox1.image是最初bitmap创建,默认是黑色,故,须用fillrectangle把背景刷成白色。


imports System.Drawingimports System.Drawing.drawing2dPublic Class Form1    Private Sub button1_Click(sender As Object,e As EventArgs) Handles button1.Click        Dim gr As Graphics        Dim bp As New Bitmap(PictureBox1.WIDth,PictureBox1.Height)        Dim pen1 As New Pen(color.Red)        pen1.DashStyle = DashStyle.DashDotDot        pen1.WIDth = 2        PictureBox1.Image = bp        gr = Graphics.FromImage(PictureBox1.Image)        gr.FillRectangle(Brushes.White,New Rectangle(0,PictureBox1.WIDth,PictureBox1.Height))        gr.Drawline(pen1,10,70,70)        PictureBox1.Image.Save("D:.bmp",System.Drawing.Imaging.ImageFormat.Bmp)        gr.dispose()    End SubEnd Class





总结

以上是内存溢出为你收集整理的vb.net画直线消失,将图形保存为bmp文件全部内容,希望文章能够帮你解决vb.net画直线不消失,将图形保存为bmp文件所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/1277183.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-09
下一篇2022-06-09

发表评论

登录后才能评论

评论列表(0条)

    保存