是让整张图片变为同一种颜色吗?
若是请用下述方法: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'删除创建的刷子
若是请用下述方法: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'删除创建的刷子
解决方案 »
- 解不开的难疙瘩
- 动态创建Label问题,请大家帮忙,急.谢谢各位
- 哪位大哥可以提供关于声纹身份认证的源码?1000分奉送。不够再加!
- 我如何能固定datagrid的第一列呀,网友说的DataGrid1.Columns(0).Locked = True其实无效,第一列还是会随滚动条滚动。
- 这条代码的问题:"LoadFiles = App.Path + "\My.pas""
- 请大家平心而论,究竟是PB好还是VB好。
- 如何取下Gif文件中的每幅图片,并显示在picturebox上,和播放方法
- 如何自定义滚动条?
- 高分求高手:值!问题见内!!
- 怎摸获得某一天是星期几
- [求助]VB+SQL SERVER
- ADO 的疑惑!--该不该用ADO?
Picture1.BackColor = CommonDialog1.Color
====================================================
图像装在什么地方?其背景是什么?要让图像的哪个部分变为公用对话框选取的颜色?
很高兴又见到你了,谢谢你上次回答我的问题。
图像在Images或Picture中,图像中间为单色,周围为透明色。要求不透明的部分变色。
CommonDialog1.ShowColor
Picture1.BackColor = CommonDialog1.Color
end sub
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 '删除创建的刷子
Picture1.BackColor = cd.Color
Picture1.Line (xleft, xtop)-(xright, xbottom), cd.Color, BF
如果图像的中间是规则的话