can i transfer picture from picturebox to textbox?
if can,what is the code?;)
Printable View
can i transfer picture from picturebox to textbox?
if can,what is the code?;)
is this what you want?
VB Code:
Option Explicit '// WIN32 API Function Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long '// WIN32 API Constant Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source Private Sub Command1_Click() Dim hdc As Long hdc = GetDC(Text1.hwnd) BitBlt hdc, 20, 20, ScaleX(Picture1.Width, vbTwips, vbPixels), _ ScaleY(Picture1.Height, vbTwips, vbPixels), _ Picture1.hdc, 0, 0, SRCCOPY ReleaseDC Text1.hwnd, hdc End Sub
That code is clever, but it will only draw the picture over the top of the textbox. You'll be unable to move the picture up and down by pressing delete and return (like you can in msWord). The textbox that comes with VB isn't advances enough to incorporate pictures like word is. You can probably download a text box somewhere that lets you do this.
then you got to look into the RichTextBox control :eek:
:p