读书人

gdi 载入图片 到hdc解决方法

发布时间: 2012-01-28 22:06:13 作者: rapoo

gdi 载入图片 到hdc
gdi 中,怎么把图片载入到hdc 中?
网上找的现在都是gdi+ 的。

我是这样写的,但hdc里没东西啊


VB code
Public Function GdiLoadPicture(ByVal hdc As Long, ByVal FileName As String, Optional bWidth As Long = 0, Optional bHeight As Long = 0) As Long  DeleteDC hdc  hdc = CreateCompatibleDC(0)    Dim bmp As Long  Dim bw As Long, bh As Long  bmp = LoadImage(0, FileName, IMAGE_BITMAP, bw, bh, LR_LOADFROMFILE)      SelectObject hdc, bmp  End Function


LoadImage是个API

[解决办法]
先得到hwnd,然后用GetDc得到hDC
[解决办法]
看看这个:
http://www.programbbs.com/doc/2942.htm

读书人网 >VB

热点推荐