用下面的语句加入一张BMP的图像到ImageList时,由于ImageList_AddMasked 会把大图像切成几个小图像,但在VB里的ImageList控件加入同张图像时却能将其缩小。现在的问题是如何加入一张大的BMP图像并保持其原有大小?
 If Not (m_hIml = 0) Then
        If Not (lhImage = 0) Then
            If (eType = IMAGE_BITMAP) Then
                If (lBackColor = -1) Then
                    lBackColor = GetImageBackColor(lhImage)
                End If
                ImageList_AddMasked m_hIml, lhImage, lBackColor
            End If
        End If
    End If
End If

解决方案 »

  1.   

    如果你是在VB6.0中.你增加图片的时候,直接使用自定义的.不用设置值就行了.以下是我的代码,完全OKOption ExplicitPrivate Sub Command1_Click()
    Set Picture1.Picture = ImageList1.ListImages(1).Picture
    End Sub
      

  2.   

    我使用的是 ImageList_Create 建立的一个ImageList,然后再用ImageList_AddMasked 加入BMP类型的图像,因某种原因不使用那个可见的ImageList控件,所以才会出现上面的困扰。
      

  3.   

    楼主,ImageList_Create函数开头的两个参数,就是让你设置列表中图象大小的!
      

  4.   

    我知道Creat的前兩個參數是設置大小,我的問題在於:
    用下面的语句加入一张BMP的图像到ImageList时,由于ImageList_AddMasked 会把大图像切成几个小图像,但在VB里的ImageList控件加入同张图像时却能将其缩小。 现在的问题是如何加入一张大的BMP图像(比Creat中指定的大)并保持其原有大小?  If Not (m_hIml = 0) Then
            If Not (lhImage = 0) Then
                If (eType = IMAGE_BITMAP) Then
                    If (lBackColor = -1) Then
                        lBackColor = GetImageBackColor(lhImage)
                    End If
                    ImageList_AddMasked m_hIml, lhImage, lBackColor
                End If
            End If
        End If
    End If
      

  5.   

    不会吧!!!!!你的图片有多大??
    我最大只试过640*480的图片还有,你怎么知道 ImageList_AddMasked 函数把你的图片分成了几个小块呢???
    是不是你输出图象的代码有问题啊???
      

  6.   

    Count属性比预想的多,DrawEx时有许多被分割的小图标。查MSDN里ImageList_AddMasked 确实会自动分割图片,可能你用的是AddIcon就不会自动分割?我添加的类型是ico时用AddIcon,BMP,JPG类型时用AddMasked