Parsi Coders
VB6 Writing text to a picture box - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Visual Basic Programming (http://parsicoders.com/forumdisplay.php?fid=39)
+---- انجمن: Visual Basic 6 (http://parsicoders.com/forumdisplay.php?fid=44)
+---- موضوع: VB6 Writing text to a picture box (/showthread.php?tid=1868)



VB6 Writing text to a picture box - Amin_Mansouri - 02-28-2012

با سورس زیر میتونید داخل یه عکس متن مورد نظر خودتون رو بنویسید.
کد:
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
Public By: Parsicoders.com

'usage
Dim rct As RECT





Private Sub Command1_Click()
DrawText Picture1.hDC, Text1.Text, -1, rct, DT_WORDBREAK
End Sub

Private Sub Form_Load()

Picture1.ScaleMode = vbPixels
With rct
    .Left = 0
    .Right = Picture1.ScaleWidth
    .Top = 0
    .Bottom = Picture1.ScaleHeight
End With

End Sub