bmp格式的图片用什么控件加载在vb的窗体中不会显示该图片的背景色,需要改控件的什么属性?谢谢

解决方案 »

  1.   

    '定义TransparentBlt函数
    '实现图片的透空效果需要用上API函数:TransparentBlt,这个函数功能十分强大,而且使用方便,但不幸的是VB自带的API浏览器居然把它的漏掉了,所以我们只有采用人工输入的方法了
    Private Declare Function TransparentBlt Lib "msimg32.dll" _
       (ByVal hdcDest As Long, _
       ByVal nXOriginDest As Long, _
       ByVal nYOriginDest As Long, _
       ByVal nWidthDest As Long, _
       ByVal nHeightDest As Long, _
       ByVal hdcSrc As Long, _
       ByVal nXOriginSrc As Long, _
       ByVal nYOriginSrc As Long, _
       ByVal nWidthSrc As Long, _
       ByVal nHeightSrc As Long, _
       ByVal crTransparent As Long) As Long
    '其中,hdcDest为目标地的HDC,nXOriginDEst和nYoriginDest分别为目标图像的起始点坐标,nWidthDesk和nHeightDest分别为目标图像的宽度和高度。与之相应的hdcSrc、nXOriginSrc、nyOriginSrc、nWidthSrc、nHeightSrc分别为原图的HDC、原图的起始X、Y坐标、原图和宽度和长度,crTransparent为需要设置成透空的颜色的RGB值。