是让整张图片变为同一种颜色吗?
若是请用下述方法:Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Dim hbrush As Long
Dim holdbrush As Long
hbrush = CreateSolidBrush(rgb(...))'创建刷子,rgb(...)为欲填充的颜色
holdbrush = SelectObject(picture1.hdc, hbrush)'选入设备场景
ExtFloodFill picture1.hdc, x, y, crColor, 1'x,y为图片里的任意一点,crColor为这一点的颜色,该函数从指定的点向外填充,只要找到了crColor。
SelectObject picture1.hdc, holdbrush
DeleteObject hbrush'删除创建的刷子

解决方案 »

  1.   

    用下面代码就可以实现了:CommonDialog1.ShowColor
    Picture1.BackColor = CommonDialog1.Color
      

  2.   

    那如果是透明的gif图像呢(图像中间是黑色的,其余为透明)
      

  3.   

    那如果是透明的gif图像呢(图像中间是黑色的,其余为透明)
    ====================================================
    图像装在什么地方?其背景是什么?要让图像的哪个部分变为公用对话框选取的颜色?
      

  4.   

    505(五五)
    很高兴又见到你了,谢谢你上次回答我的问题。
    图像在Images或Picture中,图像中间为单色,周围为透明色。要求不透明的部分变色。
      

  5.   

    private sub form_load()
    CommonDialog1.ShowColor
    Picture1.BackColor = CommonDialog1.Color
    end sub
      

  6.   

    zyl910(910:分儿,我来了!) 怎么个逐点算法.
      

  7.   

    图像在Picture中,其背景颜色不会与中间的单色一样吧?
    Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
    Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
    Private Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long
    Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
    Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    Dim hbrush As Long
    Dim holdbrush As Long
    Dim color As Long
    Picture1.ScaleMode = 3 'API函数需要
    '(x,y)为单色区域里的任意一点
    color = GetPixel(Picture1.hdc, x, y)hbrush = CreateSolidBrush(公用对话框选取的颜色) '创建刷子
    holdbrush = SelectObject(Picture1.hdc, hbrush) '选入设备场景
    ExtFloodFill Picture1.hdc, x, y, color, 1 '该函数从指定的点(x,y)向外填充,只要找到了Color,因而会一直填到单色区域的边沿。
    SelectObject Picture1.hdc, holdbrush
    DeleteObject hbrush '删除创建的刷子
      

  8.   

    if Point(x,y)=rgb(0,0,255) then pset(x,y),YourColor
      

  9.   

    cd.ShowColor
    Picture1.BackColor = cd.Color
    Picture1.Line (xleft, xtop)-(xright, xbottom), cd.Color, BF
    如果图像的中间是规则的话