|
|
 |
|
 |
X10 Senior Mod
Join Date: Aug 2007
Posts: 1,121
Credits:
10,137
Location: UK
|
|
09-20-2008, 12:20 PM
|
|
Visual Basic Help!
Hi Everyone,
Recently I have started with Visual Basic, but I've now got a little stuck...
I need a script to save the contents of a form as a JPG file.
If anyone can do this for me or tell me how to do it easily, they will recieve around 250 credits from me.
Thanks!!!
Dan
__________________
Dan Senior Moderator
DO NOT PM ME OR ANY OTHER STAFF UNLESS ASKED TO DO SO.
|
|
|
|
x10Hosting Member
Join Date: Jul 2008
Posts: 4
Credits:
254
|
|
09-20-2008, 10:08 PM
|
|
Re: Visual Basic Help!
a post in this thread does what you're looking for I think
|
|
|
|
X10 Senior Mod
Join Date: Aug 2007
Posts: 1,121
Credits:
10,137
Location: UK
|
|
09-21-2008, 08:53 AM
|
|
Re: Visual Basic Help!
Quote:
Originally Posted by andypalmer86
a post in this thread does what you're looking for I think
|
That doesn't work for me I'm afraid :(
I think that person was probably using an older version of VB. I'm running the new 2008 one...
Anyone else help me?
__________________
Dan Senior Moderator
DO NOT PM ME OR ANY OTHER STAFF UNLESS ASKED TO DO SO.
|
|
|
|
x10Hosting Member
Join Date: Oct 2007
Posts: 11
Credits:
255
|
|
09-21-2008, 12:06 PM
|
|
Re: Visual Basic Help!
Eh... Hi.. I don't have Visual Studio 2008 but if you are in problems you can add me to msn ezdookie@gmail.com for connect to your computer via VNC and make your job there...
Did you understand my english??.. uh..
P.D. That job was programmed with Visual Basic 6.0
Last edited by ezdookie; 09-21-2008 at 12:07 PM.
|
|
|
|
X10 Senior Mod
Join Date: Aug 2007
Posts: 1,121
Credits:
10,137
Location: UK
|
|
09-22-2008, 02:29 PM
|
|
Re: Visual Basic Help!
Quote:
Originally Posted by ezdookie
Eh... Hi.. I don't have Visual Studio 2008 but if you are in problems you can add me to msn ezdookie@gmail.com for connect to your computer via VNC and make your job there...
Did you understand my english??.. uh..
P.D. That job was programmed with Visual Basic 6.0
|
I'm not sure I get what you mean...
I would just like a script please that will let me do this.
Anyone?
__________________
Dan Senior Moderator
DO NOT PM ME OR ANY OTHER STAFF UNLESS ASKED TO DO SO.
|
|
|
|
x10 Sophmore
Join Date: May 2008
Posts: 239
Credits:
2,077
Location: England
|
|
|
|
x10 Sophmore
Join Date: Oct 2007
Posts: 236
Credits:
1,462
Location: England........:-)
|
|
09-23-2008, 01:01 PM
|
|
Re: Visual Basic Help!
Quote:
|
Originally Posted by http://www.developerfusion.co.uk/forums/p/26911/109890/
You can take and save a picture of your form like this:
Code:
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Function SaveFormPic() As Picture
Dim pic As StdPicture
Set pic = Clipboard.GetData(vbCFBitmap)
keybd_event vbKeyMenu, 0, 0, 0
keybd_event vbKeySnapshot, 0, 0, 0
DoEvents
keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
keybd_event vbKeyMenu, 0, KEYEVENTF_KEYUP, 0
DoEvents
Set SaveFormPic = Clipboard.GetData(vbCFBitmap)
Clipboard.SetData pic, vbCFBitmap
End Function
Private Sub Command1_Click()
SavePicture Clipboard.GetData(vbCFBitmap), "C:\MyPic.jpg" 'picture location
End Sub
The example requires one command button. It will take a picture of your form and save it into file "c:\mypic.jpg". You can change that.
Good luck.
|
From : http://www.developerfusion.co.uk/forums/p/26911/109890/
__________________
SuPaJaSoN WaS HeRE
|
|
|
|
X10 Senior Mod
Join Date: Aug 2007
Posts: 1,121
Credits:
10,137
Location: UK
|
|
09-23-2008, 01:42 PM
|
|
Re: Visual Basic Help!
Quote:
Originally Posted by supajason
|
That doesn't work either I'm afraid...
I hope I can get something that works soon.
__________________
Dan Senior Moderator
DO NOT PM ME OR ANY OTHER STAFF UNLESS ASKED TO DO SO.
|
|
|
|
Retired staff (11-12-2008)
Join Date: Jul 2006
Posts: 1,301
Credits:
7,409
Location: Hampshire
|
|
09-23-2008, 02:45 PM
|
|
Re: Visual Basic Help!
Quote:
Originally Posted by Dan
That doesn't work either I'm afraid...
I hope I can get something that works soon.
|
Try this:
Put this at the top of the class file (form file, whatever)
Code:
Imports System.Drawing
Imports System.Drawing.Imaging
And this where you want to save it
Code:
Dim img as Bitmap = new Bitmap( Me.Width, Me.Height )
Dim g as Graphics = Graphics.FromImage( img )
g.CopyFromScreen( new Point( Me.Left, Me.Top ), new Point( 0, 0 ), new Size( Me.Width, Me.Height ) )
img.Save( "filename.jpg", ImageFormat.Jpeg )
__________________
Micro
Account Manager
Do NOT PM me without my prior permission. Thanks.
|
|
|
|
X10 Senior Mod
Join Date: Aug 2007
Posts: 1,121
Credits:
10,137
Location: UK
|
|
09-24-2008, 02:45 PM
|
|
Re: Visual Basic Help!
Quote:
Originally Posted by Micro
Try this:
Put this at the top of the class file (form file, whatever)
Code:
Imports System.Drawing
Imports System.Drawing.Imaging
And this where you want to save it
Code:
Dim img as Bitmap = new Bitmap( Me.Width, Me.Height )
Dim g as Graphics = Graphics.FromImage( img )
g.CopyFromScreen( new Point( Me.Left, Me.Top ), new Point( 0, 0 ), new Size( Me.Width, Me.Height ) )
img.Save( "filename.jpg", ImageFormat.Jpeg )
|
That works just great micro!!!  
Thanks! Sending you 250 credits now for helping me.
__________________
Dan Senior Moderator
DO NOT PM ME OR ANY OTHER STAFF UNLESS ASKED TO DO SO.
|
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:04 PM.
Powered by vBulletin® Version 3.7.3 Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
Remortgages | Restaurant Equipment | Car Finance | Loan | Cheap Loan
| |