----------------------------------------------------------------------------------------------------------------------------------------------- 本文提示:《vb.net例程集锦(3)》是本站编辑们为广大网友精选的实用文章,本文阐述了关于文章的相关理论,相对来说专业性强,但是本文只是针对于某个问题提出的见解与论述,未必能辐射到相关问题的方方面面,所以本文处理问题的方法仅仅为您提供一些参考。更多问题请查阅学习中国网其他栏目哦. -----------------------------------------------------------------------------------------------------------------------------------------------
Me.Button2.Name = \"Button2\"
Me.Button2.Size = New System.Drawing.Size(115, 23)
Me.Button2.TabIndex = 1
Me.Button2.Text = \"从XML中得到图象\"
\'
\'PictureBox1
\'
Me.PictureBox1.Location = New System.Drawing.Point(18, 6)
Me.PictureBox1.Name = \"PictureBox1\"
Me.PictureBox1.Size = New System.Drawing.Size(320, 460)
Me.PictureBox1.TabIndex = 2
Me.PictureBox1.TabStop = False
\'
\'Button3
\'
Me.Button3.Location = New System.Drawing.Point(365, 28)
Me.Button3.Name = \"Button3\"
Me.Button3.Size = New System.Drawing.Size(115, 23)
Me.Button3.TabIndex = 3
Me.Button3.Text = \"浏览图片…\"
\'
\'Label1
\'
Me.Label1.Location = New System.Drawing.Point(369, 135)
Me.Label1.Name = \"Label1\"
Me.Label1.Size = New System.Drawing.Size(105, 95)
Me.Label1.TabIndex = 4
\'
\'Label2
\'
Me.Label2.Location = New System.Drawing.Point(367, 437)
Me.Label2.Name = \"Label2\"
Me.Label2.Size = New System.Drawing.Size(130, 16)
Me.Label2.TabIndex = 5
Me.Label2.Text = \"【孟宪会之精彩世界】\"
\'
\'Form1
\'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(500, 480)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.Button3, Me.PictureBox1, Me.Button2, Me.Button1})
Me.Name = \"Form1\"
Me.Text = \"图象文件和XML格式文件互换例子\"
Me.ResumeLayout(False)
End Sub
#End Region
Private MyFile As String = \"\"
Private MyFileExt As String = \"\"
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button2.Click
Dim pic As String
Dim MyXml As System.Xml.XmlDocument = New System.Xml.XmlDocument()
MyXml.Load(\"c:\\MyPhoto.xml\")
Dim picNode As System.Xml.XmlNode
picNode = MyXml.SelectSingleNode(\"/pic/photo\")
pic = picNode.InnerText
Dim memoryStream As System.IO.MemoryStream
memoryStream = New System.IO.MemoryStream(Convert.FromBase64String(pic))
Me.PictureBox1.Image = New System.Drawing.Bitmap(memoryStream)
memoryStream.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
If MyFile = \"\" Then
MessageBox.Show(\"请选择一个图片!\", \"错误\", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
Dim MyImg As System.Drawing.Image = MyImg.FromFile(MyFile)
Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream()
MyImg.Save(memoryStream, GetImageType(MyFileExt))
Dim b() As Byte
b = memoryStream.GetBuffer()
Dim pic As String = Convert.ToBase64String(b)
memoryStream.Close()
Dim MyXml As System.Xml.XmlDocument = New System.Xml.XmlDocument()
MyXml.LoadXml(\"孟宪会\" + pic + \"\")
MyXml.Save(\"c:\\MyPhoto.xml\")
Label1.Text = \"文件被保存到了:\" + Microsoft.VisualBasic.ChrW(13) + \"c:\\MyPhoto.xml\" 本文章更多内容:<<上一页 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 下一页>>收藏到:[收藏夹] [百度搜藏] [新浪ViVi] [POCO网摘] [ 和讯网摘] [好哦网摘] [Google书签] [Yahoo书签] [搜狐网摘] [365Key网摘] [天极网摘] [我摘] [博采网摘] [igooi网摘] |