Private Sub Command1_Click()
Dim i As Integer, j As Integer, lpicturewidth As Long
Dim mmessage As String, lpicpos As Long, lstartmessage As Long
With Text1
.SelStart = Len(.Text)
.SelText = mmessage + vbCrLf
lstartmessage = .SelStart
End With
If emotions = True Then
'For i = 1 To Form2.Picture1.Count
' charcombo = Split(Form2.Picture1(i - 1).Tag, " ")
For j = 0 To 3
lpicpos = InStr(lstartmessage, Text1.Text, Form2.Picture1(j).Tag)
While lpicpos > 0
Text1.SelStart = lpicpos - 1
Text1.SelLength = Len(charcombo(i)) 'Clear the char combo text
Text1.SelText = ""
TextOut Picture1.hdc, textl.SelStart, 0, Text1.Text, 20
Picture1.PaintPicture Form2.Picture1(i).Picture, Text1.SelStart, 0, Form2.Picture1(i).ScaleWidth, Form2.Picture1(i).ScaleHeight
lpicpos = InStr(lpicpos, Text1.Text, Form2.Picture1(j).Tag)
Wend
Next j
'Next i
End If
End Sub
以上代码我运行了下 居然在form1的picture1中不显示form2.picture1(j)的图片 不知道哪儿搞错了 请高手指点迷津.
Dim i As Integer, j As Integer, lpicturewidth As Long
Dim mmessage As String, lpicpos As Long, lstartmessage As Long
With Text1
.SelStart = Len(.Text)
.SelText = mmessage + vbCrLf
lstartmessage = .SelStart
End With
If emotions = True Then
'For i = 1 To Form2.Picture1.Count
' charcombo = Split(Form2.Picture1(i - 1).Tag, " ")
For j = 0 To 3
lpicpos = InStr(lstartmessage, Text1.Text, Form2.Picture1(j).Tag)
While lpicpos > 0
Text1.SelStart = lpicpos - 1
Text1.SelLength = Len(charcombo(i)) 'Clear the char combo text
Text1.SelText = ""
TextOut Picture1.hdc, textl.SelStart, 0, Text1.Text, 20
Picture1.PaintPicture Form2.Picture1(i).Picture, Text1.SelStart, 0, Form2.Picture1(i).ScaleWidth, Form2.Picture1(i).ScaleHeight
lpicpos = InStr(lpicpos, Text1.Text, Form2.Picture1(j).Tag)
Wend
Next j
'Next i
End If
End Sub
以上代码我运行了下 居然在form1的picture1中不显示form2.picture1(j)的图片 不知道哪儿搞错了 请高手指点迷津.
解决方案 »
- VB中文本框绑定到DataEnvironment的问题
- 实时错误91 对象变量或with块变量未设置
- 如何复制整列到另外的excel文件
- 请问如何让DLL控制其被调用程序的EXE的执行进程?(100求助)
- 天。。。这到底怎么啦
- 数据库查询问题,比较菜,急求解!!!
- 急!求救,存储过程出错!
- 远程数据库连接(Internet)
- can you help me ? Thank you very much!“代码是什么,请解释”
- 请问在一个窗体中加载控件(设计时和程序运行时)数量有限制吗?如果太多会怎样?
- VB中用下列函数发邮件,为什么我收到邮件的日期是1970年?
- VB中用下列函数发邮件,为什么我收到邮件的日期是1970年?
--------
www.vicmiao.com
努力就有美好时光!
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 Command1_Click()
Dim charcombo() As String, i As Integer, j As Integer, lpicturewidth As Long
Dim mmessage As String, lstartmessage As Long
Dim lpicpos As Long
With Text1
.SelStart = Len(.Text)
.SelText = mmessage + vbCrLf
lstartmessage = .SelStart
End With
lpicpos = 1
emotions = True
If emotions = True Then
For i = 1 To 100
For j = 0 To 3
lpicpos = InStr(lpicpos, Text1.Text, Form2.Picture1(j).Tag, vbTextCompare)
'Picture1.PaintPicture Form2.Picture1(0).Picture, Text1.SelStart * 4 / 3, 0, Form2.Picture1(0).ScaleWidth, Form2.Picture1(0).ScaleHeight
If lpicpos > 0 Then
Text1.SelStart = lpicpos
Text1.SelLength = Len(Form2.Picture1(i).Tag)
Text1.SelText = ""
Picture1.Print Text1.Text
Text1.SelStart = lpicpos
'Picture1.PaintPicture Form2.Picture1(i).Picture, Text1.SelStart, 0, Form2.Picture1(i).ScaleWidth, Form2.Picture1(i).ScaleHeight
lpicpos = InStr(lpicpos + 5, Text1.Text, Form2.Picture1(j).Tag)
Else
Picture1.Print Text1.Text
End If
Next j
Next i
End If
End Sub
Private Sub Command2_Click()
Picture2.Print Form2.Picture1(0).Tag
End SubPrivate Sub Form_Load()
Picture1.ScaleMode = vbPixelsEnd Sub
Private Sub Form_Load()
For i = 0 To 3
Picture1(i).ScaleMode = vbPixels
Next
End SubPrivate Sub picture1_DblClick(Index As Integer)
emotions = TrueForm1.Text1.Text = Form1.Text1.Text + Form2.Picture1(Index).Tag
DoEvents
'Form2.Hide
Form1.Show
End Sub