LoadImage PNG in excel vba form image1.picture control, black background

前端 未结 2 373
天涯浪人
天涯浪人 2021-01-06 13:51

I have code which load png images to picture control

Option Explicit
Option Private Module

Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data         


        
2条回答
  •  梦谈多话
    2021-01-06 14:40

    Why not use Insert/Picture which accepts png files? You can still assign a macro to it.

    AFAIK only png files support transparent backgrounds.

    If it's for a userform, I don't know of anything you can add that supports transparent objects. However your background should be static so you can fake it.

    Perhaps you could just match the color behind the image? You can get the color code from your form properties.

    If it's a static background but not a single color, you could take a screen shot and clip the portion you want as background for the image, layer the 2 images together in a photo editor then output as bmp which will flatten the two layers as one. There are free photo editors that can do this.

提交回复
热议问题