将两个图片框合并到一个新的图片框中 [英] Merging two pictureboxes into a new picturebox

查看:109
本文介绍了将两个图片框合并到一个新的图片框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想合并两个图片框,并在visual studio 2008中提供一个新的图片框



此代码对我有用,但它不能保持两个图像的大小。



I want merge two pictureboxes and provide a new picturebox in visual studio 2008

this code work for me but it doesn't keep the size of both the images.

Dim image1 As New Bitmap(picbox1.Image)
Dim image2 As New Bitmap(picbox2.Image)
Dim Image3 As New Bitmap(483, 338)
Dim xcount, ycount as integer

Using g As Graphics = Graphics.FromImage(Image3)

    'make 2nd bmp translucent
    Dim xcount, ycount As Integer

    For xcount = 0 To image2.Width - 1
        For ycount = 0 To image2.Height - 1
            Dim c As Color = image2.GetPixel(xcount, ycount)
            c = Color.FromArgb(125, c.R, c.G, c.B) '50% alpha
            image2.SetPixel(xcount, ycount, c)
        Next
    Next

    g.DrawImage(image1, New Point(0, 0))

    g.DrawImage(image2, New Point(0, 0))

End Using

picbox3.Image = Image3





任何帮助请。



Any Help Please.

推荐答案

这对我有用



this works for me

Dim logo As New Bitmap(picturebox1.Image)
logo.MakeTransparent()

' Display the result.
picturebox1.Image = logo

' Copy the label onto the main picture.
Dim template As New Bitmap(picturebox2.Image)
Dim gr As Graphics = Graphics.FromImage(template)
gr.DrawImage(logo, template.Width - 2007, (template.Height - 1800) \ 6, 500, 450)

' Display the result.
picturebox2.Image = template





谢谢



thank you


这篇关于将两个图片框合并到一个新的图片框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆