求助:form_load 时能执行但放到command_click没反应
- VB code
Private Declare Function TextOut Lib "gdi32 " Alias "TextOutA " (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long Private Sub Form_Load() Const sStr = "vb我爱你 " TextOut Picture1.hdc, 0, 0, sStr, tLen(sStr) SavePicture Picture1.Picture, "c:\1.bmp " End Sub Private Function tLen(ByVal expression As String) As String tLen = Len(expression) For i = 1 To Len(expression) If Asc(Mid(expression, i, 1)) < 0 Then tLen = tLen + 1 End If Next End Function
以上是一个文本输出到picturebox的代码,可以执行。
但是把
Const sStr = "vb我爱你 "
TextOut Picture1.hdc, 0, 0, sStr, tLen(sStr)
放到 command_click 中则执行没有效果
百思不得其解,求助各位了
谢谢!
[解决办法]
放到 command_click 中则执行没有效果
-----------------------------------
command_click??????
试试Command1_Click()
呵呵
[解决办法]
代码贴出来看看。
[解决办法]
把Picture1的自动重绘关闭就可以了。
- VB code
Picture1.AutoRedraw = False
[解决办法]
为什么我这儿运行你的代码出现
实时错误"453"
找不到DLL入口点TextOutA in gdi32
[解决办法]
发给我,我帮你看看吧:qq:100510037
[解决办法]
[解决办法]
- VB code
'以上方法可以不用关闭自动重绘
[解决办法]
[解决办法]
原因确认,就是11L说的原因,没有指明是string,API调用时候,VB内部提取指针错误!
给分吧
[解决办法]
还有,declare 里的textouta多了一个空格