网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
03月05日漏签0天
vb吧 关注:156,045贴子:1,166,308
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 9回复贴,共1页
<<返回vb吧
>0< 加载中...

问个GdipDrawString的问题,绘制阴天的阴字

  • 只看楼主
  • 收藏

  • 回复
  • 只会VB
  • 网络通信
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
用GdipDrawString绘制出来的“阴”字为啥是“4”?
有大牛能帮忙处理下不?
祝各位新年快乐~


  • 闪星2
  • API
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
那你为啥不发你的代码出来瞧瞧


2026-03-05 17:15:49
广告
不感兴趣
开通SVIP免广告
  • 只会VB
  • 网络通信
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Public Function DrawNormalText(ByVal strFontName As String, ByVal lngFontColor As Long, _
ByVal StringAlignMode As StringAlignment, _
ByVal sngFontSize As Single, ByVal lngFontStyle As Long, _
ByVal DrawUnit As GpUnit, ByVal TextRenderMode As TextRenderingHint, _
ByVal lngLeft As Long, ByVal lngTop As Long, _
ByVal lngWidth As Long, ByVal lngHeight As Long, ByVal strText As String) As Boolean
Dim gpP As String ' GpStatus
Dim lngCurFont As Long
Dim rclayout As RECTF
Dim lngFontFamily As Long
Dim lngStringFormat As Long
Dim lngSolidBrush As Long
Dim lngGraphics As Long
Call InitGDIPlus
'On Error GoTo errFun
gpP = gpP & "," & GdipCreateFromHDC(Me.hdc, lngGraphics)
gpP = gpP & "," & GdipCreateFontFamilyFromName(StrConv(strFontName, vbUnicode), 0, lngFontFamily)
gpP = gpP & "," & GdipCreateStringFormat(0, 0, lngStringFormat)
gpP = gpP & "," & GdipCreateSolidFill("&HFFFF0000", lngSolidBrush)
gpP = gpP & "," & GdipSetStringFormatAlign(lngStringFormat, StringAlignMode)
gpP = gpP & "," & GdipCreateFont(lngFontFamily, sngFontSize, lngFontStyle, DrawUnit, lngCurFont)
gpP = gpP & "," & GdipSetTextRenderingHint(lngGraphics, TextRenderMode)
With rclayout
.Left = lngLeft
.Top = lngTop
.Right = .Left + lngWidth
.Bottom = .Top + lngHeight
End With
gpP = gpP & "," & GdipDrawString(lngGraphics, StrConv(strText, vbUnicode), -1, lngCurFont, rclayout, lngStringFormat, lngSolidBrush)
gpP = gpP & "," & GdipDeleteFontFamily(lngFontFamily)
gpP = gpP & "," & GdipDeleteStringFormat(lngStringFormat)
gpP = gpP & "," & GdipDeleteFont(lngCurFont)
gpP = gpP & "," & GdipDeleteBrush(lngSolidBrush)
If Replace(gpP, ",0", "") <> "" Then
MsgBox gpP
End If
lngSolidBrush = 0
lngFontFamily = 0
If IsNull(gpP) Then
DrawNormalText = False
Else
DrawNormalText = True
End If
Call TerminateGDIPlus
Exit Function
errFun:
DrawNormalText = False
Call TerminateGDIPlus
End Function
Private Sub Command1_Click()
Me.Cls
DrawNormalText "宋体", vbRed, StringAlignmentCenter, 28, 1, UnitPixel, TextRenderingHintAntiAlias, 10, 10, 200, 200, Text1.Text
Me.Refresh
End Sub


  • A1Duke
  • 子类化
    13
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
先查查你GDI+模块的DRAWSTRING定义

如果定义和上图是一样的,第二个参数建议用strptr(strText)


  • 贴吧用户_0MN5MMA
  • 网络通信
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我个人觉得是unicode和ascii编码问题,vb调用api传参时的老毛病了


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 9回复贴,共1页
<<返回vb吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示