Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
成都服务器托管,成都创新互联公司提供包括服务器租用、德阳电信服务器托管、带宽租用、云主机、机柜租用、主机租用托管、CDN网站加速、域名注册等业务的一体化完整服务。电话咨询:13518219792
PictureBox1.Image = Image.FromFile("D:\python\001.jpg")
PictureBox2.Image = Image.FromFile("D:\python\001.png")
End Sub
BMP图像文件,并在VC + +环境下的GIF图像文件转换。首先分析了的BMP和GIF2图像格式,然后在VC + +环境下建立自己的库文件DIB.H和DIB.CPP,初始化的数据成员和函数成员使用,以实现BMP图像的读取,显示和保存操作。理解的原则,基于LZW编码算法的算法,在VC + +。同时,通过先前建立的在BMP图像库中,该相关函数被调用时,它可以找到对应的特定的图像数据,从而BMP图像数据被转换成一个GIF图象数据由LZW编码,图像格式转换
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ExeDMLSQL()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim strsql As String = "select * from 产品图片 where 序号=1"
Dim objcommand As New SqlCommand(strsql, New SqlConnection(connection))
objcommand.Connection.Open()
Dim myreader As SqlDataReader = objcommand.ExecuteReader()
If myreader.Read() Then
Dim imgInfo() As Byte = myreader("图片")
Dim memoryStream As New MemoryStream(imgInfo)
PictureBox1.Image = Image.FromStream(memoryStream)
End If
End Sub
Private Sub ExeDMLSQL()
Dim st As New FileStream("D:\1.png", FileMode.Open, FileAccess.Read)
Dim mbr As New BinaryReader(st)
Dim buffer(st.Length) As Byte
mbr.Read(buffer, 0, CInt(st.Length))
st.Close()
InsertImage(buffer)
End Sub
Private Sub InsertImage(ByVal buffer() As Byte)
Dim cn As New SqlConnection(connection)
cn.Open()
Dim cmd As New SqlCommand("SaveImg", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = 1
cmd.Parameters.Add("@image", SqlDbType.Image).Value = buffer
cmd.ExecuteNonQuery()
MsgBox("Image inserted.")
cn.Close()
End Sub
SaveImg是一个存储过程:
ALTER PROCEDURE dbo.SaveImg
@name AS int,
@image AS IMAGE
AS
INSERT INTO 产品图片 (序号, 图片)
VALUES (@name, @image)
Dim url As String=" 网址"
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与
Internet资源建立持久连接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream,
System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码