【问题标题】:How to add an image to an existing bitmap in vb?如何将图像添加到vb中的现有位图?
【发布时间】:2015-12-16 02:50:58
【问题描述】:

假设我有一个 600 x 600 的位图,我想在该位图中的 x 和 y 位置添加一个图像。我该怎么做?例如:我有一个 600 x 600 的位图,我想在 x 为 0 和 y 为 0 的位图中添加一个 20 x 20 的图像?有没有一种简单的方法可以做到这一点,比如预制功能?谢谢。 :)

【问题讨论】:

    标签: vb.net image bitmap


    【解决方案1】:

    它相当容易。您可以使用Graphics Class 来做您想做的事。您可能希望在 VB.net 项目中导入默认已引用的“System.Drawing”。

    要使用此类,您必须执行以下操作:

    Using GraphicsObject as Graphics = Graphics.FromImage([Original Bitmap])
        GraphicsObject.Drawimage([Bitmap to Draw], X, Y) 
        'X, Y are the coordinates (inside the bitmap we're drawing into), of where the new bitmap will be drawn
        ' The bitmap will be drawn with its original Width and Height
    End Using
    

    Graphics.DrawImage 方法已重载,您可以根据您选择提供给它的参数选择以多种不同方式绘制图像。

    希望这会有所帮助,玩得开心。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-04
      • 1970-01-01
      • 2013-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多