下边是代码:
Dim Ret As String
Dim sPath As String
Me.ScaleMode = 3
Me.Cls
Me.AutoRedraw = True
sPath = "c:\01.png"
Call InitGDIPlus
Dim graphic As Long
Dim img As Long
Ret = Ret & "_" & GdipCreateFromHDC(Me.hdc, graphic)
Ret = Ret & "_" & GdipLoadImageFromFile(StrConv(sPath, vbUnicode), img)
Ret = Ret & "_" & GdipDrawImageRectRect(graphic, img, 10, 10, 20, 20, 0, 0, 100, 100, UnitPixel)
Ret = Ret & "_" & GdipDisposeImage(img)
Ret = Ret & "_" & GdipDeleteGraphics(graphic)
Call TerminateGDIPlus
Me.Refresh
Debug.Print Ret
查看输出的Ret,返回的都是0,但窗体上就是没图片,使用GdipDrawImageRect可以画出来
恳求大牛帮忙解决~
Dim Ret As String
Dim sPath As String
Me.ScaleMode = 3
Me.Cls
Me.AutoRedraw = True
sPath = "c:\01.png"
Call InitGDIPlus
Dim graphic As Long
Dim img As Long
Ret = Ret & "_" & GdipCreateFromHDC(Me.hdc, graphic)
Ret = Ret & "_" & GdipLoadImageFromFile(StrConv(sPath, vbUnicode), img)
Ret = Ret & "_" & GdipDrawImageRectRect(graphic, img, 10, 10, 20, 20, 0, 0, 100, 100, UnitPixel)
Ret = Ret & "_" & GdipDisposeImage(img)
Ret = Ret & "_" & GdipDeleteGraphics(graphic)
Call TerminateGDIPlus
Me.Refresh
Debug.Print Ret
查看输出的Ret,返回的都是0,但窗体上就是没图片,使用GdipDrawImageRect可以画出来
恳求大牛帮忙解决~