سلام به همه دوستان
من هم دنبال این موضوع خیلی گشتم اما پیدا نکردم
از دوستان هم می خواهم در این زمینه کمک کنند
ممنون
با سلام مجدد
من چند کد پیدا کردم که جواب داد اما مشکل اینجاست که نمیشه عکس را متن ذخیره کرد
Private Sub Command1_Click()
PrintText "This is my really really really really long text that i want to print"
End Sub
Sub PrintText(StrText As String)
If Picture1.TextWidth(StrText) > Picture1.ScaleWidth Then
x = InStr(1, StrReverse(StrText), " ")
While Not x = 0
If Picture1.TextWidth(Left(StrText, Len(StrText) - x)) < Picture1.ScaleWidth Then
StrText = Left(StrText, Len(StrText) - x) & vbCrLf & Right(StrText, x)
x = 0
Else
x = InStr(x + 1, StrReverse(StrText), " ")
End If
Wend
End If
Picture1.Print StrText
End Sub
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Const DT_WORDBREAK = &H10
'usage
Dim rct As RECT
Picture1.ScaleMode = vbPixels
With rct
.Left = 0
.Right = Picture1.ScaleWidth
.Top = 0
.Bottom = Picture1.ScaleHeight
End With
DrawText Picture1.hDC, Text1.Text, -1, rct, DT_WORDBREAK