资讯

精准传达 • 有效沟通

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

vb.net图片上传 vb中加载图片

asp.net (vb) 中kindeditor无法上传本地图片,提示是:服务器故障!怎么修改!请大家帮帮忙!谢谢了!

设置没有完全 你再好好查查kindeditor的配置方法,最好是WEBCONFIG文件里要设置上传图片的路径

我们提供的服务有:成都网站设计、成都网站建设、微信公众号开发、网站优化、网站认证、麻章ssl等。为千余家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的麻章网站制作公司

vb.net中,如何点击按钮调出选择文件窗口选中图片并在picturebox中显示出来?

button , OpenFileDialog , PictureBox , textbox 控件,我把图片显示在 picturebox 中,而路

径存放在 textbox 中,不知道这样行不行。

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

Dim filename As String

OpenFileDialog1.Filter = "jpg files (*.jpg)|*.jpg"

OpenFileDialog1.FilterIndex = 1

If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

filename = OpenFileDialog1.FileName

Else

End

End If

If Not (PictureBox1.Image Is Nothing) Then

PictureBox1.Image.Dispose()

PictureBox1.Image = Nothing

End If

'PictureBox1.Image = System.Drawing.Image.FromFile(filename)

去掉注释后就显示图片

TextBox1.Text = filename

End Sub

picturebox中只记录文件存放的路径,我找了一个 ImageLocation 函数

PictureBox1.ImageLocation = filename 不过还是会显示图片

vb.net 中如何将图片保存到SQL数据库

#Region "二进制文件的存储函数" Public Function BinaryToFile(ByRef TableRowColItem As Object, ByVal FileName As String) As Boolean Dim data As Byte() = TableRowColItem

Dim myfilestream As New System.IO.FileStream(FileName, IO.FileMode.Create)

myfilestream.Write(data, 0, data.Length)

myfilestream.Close()

Return True

End Function Public Function BinaryToImage(ByRef TableRowColItem As Object, ByRef image As Image) As Boolean Dim data As Byte() = TableRowColItem Dim imgStream As New System.IO.MemoryStream '(data)

imgStream.Write(data, 0, data.Length)

image = System.Drawing.Image.FromStream(imgStream)

imgStream.Close()

imgStream.Dispose() Return True

End Function

Public Function BinaryFromFile(ByVal FileName As String, ByRef TableRowColItem As Object) As Boolean Using myfilestream As New FileStream(FileName, FileMode.Open, FileAccess.Read)

Dim data() As Byte

ReDim data(myfilestream.Length - 1)

myfilestream.Read(data, 0, myfilestream.Length)

myfilestream.Close()

TableRowColItem = data End Using

Return True

End Function Public Function BinaryFromImage(ByRef Image As Image, ByRef TableRowColItem As Object) As Boolean

Dim imgStream As New MemoryStream

Dim b As New Bitmap(Image) b.Save(imgStream, System.Drawing.Imaging.ImageFormat.Jpeg) Dim data As Byte() = imgStream.GetBuffer

TableRowColItem = data

data = TableRowColItem

imgStream.Close()

imgStream.Dispose() Return True

End Function Public Function BinaryFromImage(ByVal Image As Image, ByRef TableRowColItem As Object, ByVal imgFormat As System.Drawing.Imaging.ImageFormat) As Boolean

Dim imgStream As New MemoryStream

'Image.Save(imgStream, imgFormat)

'Dim b As New Bitmap(Image)

'b.Save("c:\a.bmp", imgFormat)

'b.Save("c:\a.bmp", imgFormat) Dim data As Byte() = imgStream.GetBuffer TableRowColItem = data

data = TableRowColItem

imgStream.Close()

Return True

End Function

#End Region

vb.net中,如何像下图一样,用很简单的办法,导入1000张图片。

很简单的方法,貌似没有。这个需要自己写很多代码:

用一个ListView控件。

判断滚动条当前所显示的图片集合,获取它们的物理路径。

用Bitmap.FromImage方法把这些图片读出来,

然后获取缩略图,

把缩略图用Graphics.DrawImage()绘制出来。

我可以提供Bitmap如何获取缩略图的方法:

''' summary必须创建一个委托并将对此委托的引用作为获取缩略图 callback 参数传递,但不使用此委托。/summary

Public Function ThumbnailCallback() As Boolean

Return False

End Function

''' summary返回Image,表示图像指定 宽 和 高 的缩略图。/summary

Public Function 获取缩略图(位图 As Bitmap, 宽 As Integer, 高 As Integer) As Image

Dim myCallback As New Image.GetThumbnailImageAbort(ThumbnailCallback)

Return 位图.GetThumbnailImage(宽, 高, myCallback, IntPtr.Zero)

End Function


文章题目:vb.net图片上传 vb中加载图片
当前URL:http://cdkjz.cn/article/doidocp.html
多年建站经验

多一份参考,总有益处

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

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

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