下你所需,载你所想!
汇集开发技术源码资料

修改任何软件图标无模块

:311.774KB :1 :2021-02-11 17:23:40

部分简介

判断位深是否符合要求
.如果真 (hSrcDC = 0 或 nBitCount ≠ 1 且 nBitCount ≠ 4 且 nBitCount ≠ 8 且 nBitCount ≠ 16 且 nBitCount ≠ 24 且 nBitCount ≠ 32)
返回 (假)
.如果真结束
nSrcWidth = SrcRect.Right - SrcRect.Left ' 算出位图宽度
nSrcHeithe = SrcRect.Bottom - SrcRect.Top ' 算出位图高度
' 确保该dib的大小,颜色位数符合要求
.如果真 (m_pDIB = { } 或 GetBitCount () ≠ nBitCount 或 GetWidth () ≠ nSrcWidth 或 GetHeight () ≠ nSrcHeithe)
m_pDIB = { }
Create (nSrcWidth, nSrcHeithe, nBitCount, )
.如果真结束
' 创建DibSection并选进以MemDC
hMemDC = CreateCompatibleDC (hSrcDC)
pSrcBits = 0
hDibSect = CreateDIBSection (hSrcDC, m_pDIB, #DIB_RGB_COLORS, pSrcBits, 0, 0)
hOldBitmap = SelectObject (hMemDC, hDibSect)
' 复制源dc内容到MemDC即到DibSection
BitBlt (hMemDC, 0, 0, nSrcWidth, nSrcHeithe, hSrcDC, SrcRect.Left, SrcRect.Top, #SRCCOPY)
GdiFlush ()
' 复制位图点阵数据到本DIB对象
memcpy (GetBitsAddress (), pSrcBits, GetBitsSize ())
' 删除相关句柄
R = DeleteObject (SelectObject (hMemDC, hOldBitmap))
R = DeleteObject (hOldBitmap)
DeleteDC (hMemDC)

热门推荐

相关文章