资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vbnet保留绘图 vb系统保留字

VB.net 怎样保存picturebox中的图像(vs2008)

'因为要保存picturebox中的图片必须要设置autoredraw属性为true,所以也写出来了.

10年积累的成都网站制作、网站建设、外贸网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有襄城免费网站建设让你可以放心的选择与我们合作。

Private Sub Form_Load()

Picture1.AutoRedraw = True

End Sub

Private Sub Command1_Click()

SavePicture Picture1.Image, App.Path "\1.bmp"

End Sub

请问VB.net中如何保存BMP/jpg图像

我理解你

我写过图片网络传输的和你要求的一样

为了不把图片写到硬盘 又从硬盘读取

而直接保存图片内存流 进行网络传输

从网络读取的图片byte数组转成图片代码如下

Dim mStream As New IO.MemoryStream

mStream.Write(b, 0, b.length) '这里b就是你的一维数组了

Dim Img As New Bitmap(mStream)

mStream.Close()

mStream.Dispose()

下面是把图片保存到一维数组的方法

Dim Stream As New IO.MemoryStream

im.Save(Stream, System.Drawing.Imaging.ImageFormat.Jpeg)

im = Nothing

Stream.Flush()

Dim b As Byte() = Stream.ToArray

Stream.Dispose()

vb.net GDI绘图刷新问题

绘图代码写在Paint事件中,如

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

Dim g As Graphics = Me.CreateGraphics

g.DrawLine(Pens.Red, 100, 100, 200, 100)

End Sub

'方法二:在 PictureBox1上显示图像----图画在Bitmap

PictureBox1.Image = Nothing

Dim wid As Integer = PictureBox1.ClientSize.Width

Dim hgt As Integer = PictureBox1.ClientSize.Height

Dim bm As New Bitmap(wid, hgt)

Dim g As Graphics = Graphics.FromImage(bm)

'画图代码

'画图代码

PictureBox1.Image = bm

PictureBox1.Refresh()

g.Dispose()

关于vb.net中绘图并保存图片的问题

Imports System.Drawing.Imaging

Public Class Form1

Dim imageName As String = "C:\Documents and Settings\...\1126.jpg "

Dim i As Image = Image.FromFile(imageName)

Dim g As Graphics = Graphics.FromImage(i) '此处从背景图创建Greaphics

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'划线

Dim BluePen As New Pen(Color.Blue, 5)

BluePen.DashStyle = Drawing2D.DashStyle.Solid

g.DrawLine(BluePen, 100.0F, 170, 500.0F, 170)

g.Dispose()

PictureBox1.Image = i

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

'退出

Me.Close()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

'存盘

i.Save( "C:\testimage.jpg ", ImageFormat.Jpeg)

i.Dispose()

End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

PictureBox1.Image = i

End Sub

End Class


网页标题:vbnet保留绘图 vb系统保留字
转载来于:http://cdkjz.cn/article/dddcodd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220