![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
在VB6用GDI 绘制文字却得到无文字绘制上去的空白图
在一个窗体中,放置一个图片框Picture1,图片框中加载一张3008*2000的大图像,工程引用GDPPlus.tlb,利用strText=“GDI在图像上绘制文字”g...
在一个窗体中,放置一个图片框Picture1,图片框中加载一张3008*2000的大图像,工程引用GDPPlus.tlb,利用
strText=“GDI在图像上绘制文字”
gpP = GdipCreateFromHDC(Picture1.Hdc, lngGraphics)
gpP = GdipCreateFontFamilyFromName(StrConv(strFontName, vbUnicode), 0, lngFontFamily)
gpP = GdipCreateStringFormat(0, 0, lngStringFormat)
gpP = GdipCreateSolidFill(lngFontColor, lngSolidBrush)
gpP = GdipSetStringFormatAlign(lngStringFormat, StringAlignMode)
gpP = GdipCreateFont(lngFontFamily, sngFontSize, lngFontStyle, DrawUnit, lngCurFont)
gpP = GdipSetTextRenderingHint(lngGraphics, TextRenderMode)
With rclayout
.Left = lngLeft
.Top = lngTop
.Right = lngWidth
.Bottom = lngHeight
' .Width = lngWidth
' .Height = lngHeight
End With
gpP = GdipDrawString(lngGraphics, strText, -1, lngCurFont, rclayout, lngStringFormat, lngSolidBrush)
gpP = GdipDeleteFontFamily(lngFontFamily)
gpP = GdipDeleteStringFormat(lngStringFormat)
gpP = GdipDeleteFont(lngCurFont)
gpP = GdipDeleteBrush(lngSolidBrush)
lngSolidBrush = 0
lngFontFamily = 0
Picture1.Refresh
On Error Resume Next
SavePicture Picture1.Image, StrDir & "\bmp.bmp" '奇怪的事发生了,保存出来的是空白的图像,不知何故?或者保存出来的是无任何文字的原图像。
哪位能提供一个正确的实例参考参考。 展开
strText=“GDI在图像上绘制文字”
gpP = GdipCreateFromHDC(Picture1.Hdc, lngGraphics)
gpP = GdipCreateFontFamilyFromName(StrConv(strFontName, vbUnicode), 0, lngFontFamily)
gpP = GdipCreateStringFormat(0, 0, lngStringFormat)
gpP = GdipCreateSolidFill(lngFontColor, lngSolidBrush)
gpP = GdipSetStringFormatAlign(lngStringFormat, StringAlignMode)
gpP = GdipCreateFont(lngFontFamily, sngFontSize, lngFontStyle, DrawUnit, lngCurFont)
gpP = GdipSetTextRenderingHint(lngGraphics, TextRenderMode)
With rclayout
.Left = lngLeft
.Top = lngTop
.Right = lngWidth
.Bottom = lngHeight
' .Width = lngWidth
' .Height = lngHeight
End With
gpP = GdipDrawString(lngGraphics, strText, -1, lngCurFont, rclayout, lngStringFormat, lngSolidBrush)
gpP = GdipDeleteFontFamily(lngFontFamily)
gpP = GdipDeleteStringFormat(lngStringFormat)
gpP = GdipDeleteFont(lngCurFont)
gpP = GdipDeleteBrush(lngSolidBrush)
lngSolidBrush = 0
lngFontFamily = 0
Picture1.Refresh
On Error Resume Next
SavePicture Picture1.Image, StrDir & "\bmp.bmp" '奇怪的事发生了,保存出来的是空白的图像,不知何故?或者保存出来的是无任何文字的原图像。
哪位能提供一个正确的实例参考参考。 展开
1个回答
展开全部
Picture1.AutoRedraw = False
Set Picture1.Picture = Picture1.Image
SavePicture Picture1.Picture, StrDir & "\bmp.bmp
Set Picture1.Picture = Picture1.Image
SavePicture Picture1.Picture, StrDir & "\bmp.bmp
更多追问追答
追问
没用!真奇怪!
追答
HI我,我看看
![](https://ecmc.bdimg.com/public03/b4cb859ca634443212c22993b0c87088.png)
2024-07-20 广告
作为深圳市博思云创科技有限公司的工作人员,对于Word文档生成PPT的操作,我们有以下建议:1. 使用另存为功能:在Word中编辑完文档后,点击文件->另存为,选择PowerPoint演示文稿(*.pptx)格式,即可将文档内容转换为PPT...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询