|
-
Apr 18th, 2008, 05:01 PM
#1
Thread Starter
Addicted Member
-
Apr 19th, 2008, 02:46 PM
#2
Thread Starter
Addicted Member
Re: I got the idea from PDF File
I'm waiting your reply
-
Apr 19th, 2008, 04:10 PM
#3
Re: I got the idea from PDF File
Heres one way to do it, though note it captures the area where the textbox is, so if anything is on top of the textbox it would also get captured!
Code:
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
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
Code:
Private Sub Command1_Click()
' // Example: Capture Text area and save to BMP file //
Dim TxtArea As RECT
Dim MyDC As Long
MyDC = GetDC(0)
If MyDC Then
Picture1.AutoRedraw = True
Picture1.BorderStyle = 0
Picture1.Height = Text1.Height
Picture1.Width = Text1.Width
GetWindowRect Text1.hwnd, TxtArea
' copy text box area to pic box.
BitBlt Picture1.hdc, 0, 0, TxtArea.Right - TxtArea.Left, _
TxtArea.Bottom - TxtArea.Top, MyDC, TxtArea.Left, TxtArea.Top, vbSrcCopy
' Save as BMP file.
SavePicture Picture1.Image, "C:\TEST.BMP"
ReleaseDC 0, MyDC
End If
End Sub
If you rather save it as a JPG so it's a smaller size you could use this module.
and change
Code:
SavePicture Picture1.Image, "C:\TEST.BMP"
to
Code:
SaveJPG Picture1.Image, "C:\TEST.JPG", 100 ' 100 = best quality
Last edited by Edgemeal; Apr 19th, 2008 at 04:54 PM.
-
Apr 21st, 2008, 05:17 PM
#4
Thread Starter
Addicted Member
-
Apr 21st, 2008, 07:09 PM
#5
Hyperactive Member
Re: I got the idea from PDF File
Why don't you just create PDf from your text file and send it to your friends ?
-
Apr 21st, 2008, 07:13 PM
#6
Re: I got the idea from PDF File
 Originally Posted by alkater
it's very beautiful code
but i want to when i try to press to Save As to ask me to where do you want to save the image , I do not like to save the image directly in C drive
how to can I do that ?
For a "Save As" dialog personally I prefer using API code like this, or you could use the Common Dialog control in VB.
and is it possible to save the text as PDF , I'd like to create another button to Save it As PDF
is it possible to do that
I think there is, offhand don't know, did you try searching? Check out Planet Source Code .com too, lots of code there.
Last edited by Edgemeal; Apr 22nd, 2008 at 12:13 AM.
-
Apr 22nd, 2008, 11:15 AM
#7
Thread Starter
Addicted Member
Re: I got the idea from PDF File
I'd like to do the step of PDF file by VB6 if that possible
I'd like to get solution
-
Apr 22nd, 2008, 08:08 PM
#8
Re: I got the idea from PDF File
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|