vb.net 两个PNG文件叠加处理方式

vb.net 两个PNG文件叠加处理方式,第1张

概述一、从文件加载 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFilename1 As String Dim Pic1 As System.Drawing.Image
   一、从文件加载
 Private Sub button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles button1.Click        Dim strfilename1 As String        Dim Pic1 As System.Drawing.Image        strfilename1 = "c:.png"        Pic1 = System.Drawing.Image.Fromfile(strfilename1)        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage        'PictureBox1.Image = Pic1        Dim Pic2 As System.Drawing.Image        Dim strfilename2 As String = "c:.png "        Pic2 = System.Drawing.Image.Fromfile(strfilename2)        Dim b As New System.Drawing.Bitmap(Pic2.WIDth,Pic2.Height,PixelFormat.Format32bppArgb)  '这个地方是做透明处理结果的        Dim g As Graphics = Graphics.FromImage(b)        g.Clear(color.transparent)        g.DrawImage(Pic2,New Rectangle(0,Pic2.WIDth,Pic2.Height),GraphicsUnit.Pixel)        g.DrawImage(Pic1,Pic1.WIDth,Pic1.Height),GraphicsUnit.Pixel)        PictureBox1.Image = b        PictureBox1.Backcolor = color.transparent        'b.Save("c:.png")    End Sub
  '从资源文件中加载    Private Sub button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles button2.Click        Dim Pic1 As System.Drawing.Image        Pic1 = My.Resources._1        Dim Pic2 As System.Drawing.Image        Pic2 = My.Resources._2        Dim b As New System.Drawing.Bitmap(Pic2.WIDth,PixelFormat.Format32bppArgb) '这个地方是做透明处理结果的        Dim g As Graphics = Graphics.FromImage(b)        g.Clear(color.transparent)        g.DrawImage(Pic2,GraphicsUnit.Pixel)        PictureBox1.Image = b        PictureBox1.Backcolor = color.transparent  '这个地方是做透明处理结果的        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage        ' b.Save("c:.png")    End Sub
总结

以上是内存溢出为你收集整理的vb.net 两个PNG文件叠加处理方式全部内容,希望文章能够帮你解决vb.net 两个PNG文件叠加处理方式所遇到的程序开发问题。

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

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

原文地址: http://outofmemory.cn/langs/1291071.html

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

发表评论

登录后才能评论

评论列表(0条)

保存