Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Saving Msflexgrid As Picture .bmp Or .jpeg


How can I save the msflexgrid control as a .bmp file or jpeg file?
I have a msflexgrid control on a form with some data init..but I wasnt to save it as a .bmp as it is seen on the form..any solutions..thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Saving A Created Picture As A Jpeg Or Bitmap
My program makes a little graph in a picture box. how would i go about saving that graph as a jpeg or bitmap?

Saving As JPEG
Does anybody know any way for me to save a picture as JPEG in VB? I only know the SavePicture Method/Function (I don't know which one it is), but it only saves an edited picture as BMP. Thanks!

Saving To Jpeg
Does anyone knows how to save a picture from a picture box to a file under jpg format ??

Autosizing A Bmp, Jpeg, Gif And Saving It..
Forgive me if this kind of question has been answered previously. I've been doing database programming for business apps for 5 years but have practically no experience with graphics.

I'm using VB6, and I originally found a Kodak Image Edit Control that did what I wanted, only to find out that I can't get it with Windows XP. I have not been able to duplicate what I accomplished with it, and I don't want to resort to paying for a 3rd party control (I'm rather miffed that Microsoft took the control away after I got it to work).

This is what I was able to do with the Image Edit control:

1) Load an image into the control
2) Click a button that resizes the image
3) Save the resized version of the image to a specified path

I tried using Microsoft's "replacement" of the aforementioned control called the Microsoft Windows Image Acquisition Control Library. Somewhere in the Help file for this it says that it can be used to display an image on a form, but I'm having no luck accomplishing that part. I found code that does a nice job of creating the appropriate objects for loading, resizing and saving a picture, but I can't figure out how to/if it's really possible to display the picture using the control.

So my question is, can this library be used for displaying the image on the form or can I use a regular image or picturebox control to do what I want?

Any help is appreciated, I've been pulling out both dark and gray hair trying to figure this out..

Saving In Gif/jpeg Format
HI everyone,

Can anybody tell me how to save a image in a gif or/and jpeg format through vb code.

JPEG Resizing And Saving.
I am planning a vb application and am slowly working out how each part of it will work. At the moment I need to read in a jpeg, resize it and save it out. After some suggestions I tried using StretchBlt and the Intel Libraries however this has not seemed to work. I would appriciate it if someone could look through the following and let me know where I went wrong.

An 400 X 300 jpeg image is loaded in a picture box using:
Set a.Picture = LoadPicture(Text1.Text)

Then the image is resized using StretchBlt

Located in a module is:
Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Public Declare Function GetLastError Lib "kernel32" () As Long
Public Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long
Public Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
Public Const LANG_NEUTRAL = &H0
Public Const ScrCopy = &HCC0020

and in the main form:
Call StretchBlt(Picture2.hdc, 1, 1, 200, 150, a.hdc, 1, 1, a.ScaleWidth, a.ScaleHeight, vbSrcCopy)
Picture2.Refresh


The above code works similar to how I expected where it scales down an image but unfortunatly it is not the image in the picture box i wanted but rather the whole monitor output similar to print screen in a very small scaled down form.

Accepting that this would need some work I figured I may as well test the intel jpeg library however unfortunatley this also fails. I get a vb runtime error '26001' "Failed to save jpeg -8" when using:

Dim sI As String
Dim c As New cDIBSection
Dim i As Long

Set c = New cDIBSection
c.CreateFromPicture Picture2.Picture

sI = "c:Tempvb.jpg"
If VBGetSaveFileName(sI, , , "JPEG Files (*.JPG)|*.JPG|All Files (*.*)|*.*", 1, , , "JPG", Me.hwnd) Then
If SaveJPG(c, sI) Then
' OK!
Else
MsgBox "Failed to save the picture to the file: '" & sI & "'", vbExclamation
End If

End If

Guessing that the problem could be related to the StretchBlt i have tried saving another image and this worked, also trying to get a better understanding I tried to duplicate the image formed by StretchBlt in another picture box but this also seems to fail.


Thanks

Liaaam

Saving Jpeg Image
Hi all!

I have a picturebox with an image in it (it's a screenshot actualy) and i would like to save this image to a jpeg file using freeimage. Anyone have a clue of how this can be achived?

Help is apprichiated!

Saving As A JPEG/TIFF
Basically I want to create a program where the user enters a doctors name, bio and selects a picture from their hard disk. Then I need the program to be able to save the name, bio, and picture as one picture file (either JPEG or TIFF) to a preset layout.

If not, then I want to be able to save it to a Word template.

Can someone point me in the right direction?

I am using VB .NET

Saving Jpeg After Scaling
i want to scale a jpeg image and then save it.
please help!!!!!!!!!!!

Saving As A JPEG/TIFF
Basically I want to create a program where the user enters a doctors name, bio and selects a picture from their hard disk. Then I need the program to be able to save the name, bio, and picture as one picture file (either JPEG or TIFF) to a preset layout.

If not, then I want to be able to save it to a Word template.

Can someone point me in the right direction?

I am using VB .NET

Saving A Image As JPEG
Does anybody know how to save an image from a picture box as a jpeg file,GIF file or some smaller file formats instead of the bitmap files which are large in size????

Saving Mschart As Jpeg
Does anyone out there know how you would go about saving an mschart as a jpeg

Saving A Image As JPEG
Does anybody know how to save an image from a picture box as a jpeg file,GIF file or some smaller file formats instead of the bitmap files which are large in size????

Saving A Form As JPEG Or PDF
Hallo friends,

can we save a form as JPEG or PDF when the command button is executed.

please can anybody give me an code for such a button for normal Form.

Thanks in advance

Singoi

Saving Application Screenshot As JPEG
After messing with this for awhile, I think I've succeeded in figuring out a way to save the in-focus form of my running application as a screenshot, in jpg format rather than bitmap format. I'm including the zipped project as an attachment for others to test and perhaps benefit from.

Edit: (Attachment removed by GarrettSever)

Getting Data From Clipboard, Saving To Jpeg
Anyone have sample code or advice for where to start when obtaining the data from the clipboard and saving into a jpeg of a certain resolution and depth?

Saving A JPEG From A Blit ::RESOLVED::
How can I save a JPEG from a blit (StretchBlt). I'm using the ijl11.dll, but I'm free to change my ways if someone has an easier way.
What's happening is when I go to save I make my cDIBSection from the picture box's .Image, because the .Picture has no picture loaded (it was blitted in), it comes out black. So all the info for the picture I want to save is in the .Image. And for some reason it saves the file as solid black. Anyone run into this before? Is there a cDIBSection setting I need to set? Would it work to save as a byte array? If so how do I make my blitted image into a byte array?

Enough Questions?

NOMAD

Saving Bitmap In Picturebox As Gif Or Jpeg
how would i save a bitmap in picturebox as gif or jpeg??

Saving Graphics To A Jpeg (or Bitmap)
I've created a graph using various objects (lines, shapes, etc) on a picture container. Using the SavePicture function does not get those child graphics. How can I save my graph to a file? Can't be a screen capture.

Fred
     

Saving MSChart Contents In JPEG Format
Hi everyone,

I am able to save a MSChart contents using the method described in Microsoft Knowledge Base Article - Q197487. It is similar to the .EditCopy/.EditPate method of MSChart. It basically copies the chart into a pictureBox (using API) and then copies it into the clipboard and you can save it. I am using SavePicture to save the picture from picBox to file.

My problem is that it it does this in bmp format. I need to save it in JPEG format. Any idea how I can do this.

Thanx...

Saving Clipboard Data ( Image ) To JPEG
Hello fellows!
I'm trying to save a JPG file from the clipboard data without using any DLLs.
I found this code on another topic:

http://www.pscode.com/vb/scripts/Sho...50065&lngWId=1

It works very well when opening an image from disk and saving it to JPG, but I'm not getting this code to work with clipboard data.
The code when the program fills the data ( that will be saved in the future ) is in this sub:


Code:
Private Sub mnuOpen_Click()
Dim MyPic As StdPicture
Dim FileName As String

FileName = FileDialog(Me, False, "Open Picture File", "Picture Files|*.jpg;*.jpeg;*.gif;*.bmp;*.wmp;*.rle;*.cur;*.ico;*.emf|All Files [*.*]|*.*")
If Len(FileName) > 0 Then
On Error Resume Next
Set MyPic = LoadPicture(FileName)
If Err.Number = 0 Then
Set m_Image = New cImage
m_Image.CopyStdPicture MyPic
If mnuAutosize.Checked Then SetFormSize m_Image
AdjustScrollBars m_Image
Me.Caption = App.Title & " - " & FileTitleOnly(FileName)
mnuSave(0).Enabled = True
Else
MsgBox "Can not load picture file" & vbCrLf & """" & FileName & """", vbExclamation, "File Load Error"
End If
Set MyPic = Nothing
End If

End Sub
As you can see, he loads an image file using LoadPicure() and then passes the result to the m_Image.CopyStdPicture, which receives an StdPicture as an argument. I tried to load the picture this way, but its not working:


Code:
Set MyPic = Clipboard.GetData
It seems that the data from the Clipboard.GetData is in a different format than the data that LoadPicture() returns, so the cImage class cannot "understand". What can I do to get this code to work ( withou using Intel JPG dlls and other ones )?

Thanks a lot!
Fergo

Saving To Jpeg Format Form Picturebox?
I know it's probably not easy to do this, especially when the picturebox can't be seen...

I've tried saving an image in a picturebox as a BMP and the using bmp2jpeg.dll to convert it to a smaller jpeg file, but, this dll has memory issues, it never releases the memory it uses to load and convert images.

I need to run this in a loop, so speed would be nice, do you have any ideas?

Taking A Screenshot And Saving It As A File (bmp/jpeg Etc.)
hi, here's the thing:

i want Vb to make a screenshot and save it as a bmp/jpg/etc.

i already got this (see far down), but it just makes a screenshot:


so, can anyone help me?

thx in advance,
-Tonnic




Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Private Sub Command1_Click()
Dim wScreen As Long
Dim hScreen As Long
Dim w As Long
Dim h As Long
Picture1.Cls

wScreen = Screen.Width Screen.TwipsPerPixelX
hScreen = Screen.Height Screen.TwipsPerPixelY

Picture1.ScaleMode = vbPixels
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight


hdcScreen = GetDC(0)

r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcScreen, 0, 0, wScreen, hScreen, vbSrcCopy)

End Sub

Daving Picture Box To JPEG Or GIF
Ive been hunting around for this for a while, Ive found NoErrors GDI+ thing which will work perfectly however i dont want to use Common Dialog controls. How can i save from a picture box to GIF using the GDI without using common dialog controls. Currently im using savepicture, but that creates a BMP which is far to large.

Save Picture As Jpeg.
Is it possible to save an image in a picture box or image box directly to a jpeg as opposed to a bmp.

From Picture Box To JPEG File
id like to make a program that makes a screenshot every time you press a key and store it in a folder...
is it possible ?

Adding JPEG Or BMP Picture
Hi! Im doing personnel profile program using vb6, how to add picture to the file?

Name : xxxxx add Picture (cmd button)
ID # : xxxxx

Save Picture As JPEG
Hi,

I can't seem to find a way to draw on a picture control, and have the result saved as a .JPEG or .GIF file. I have been playing with the savepicture method, but can't seem to get it to save what I want.

Thanks for any help,
jeddo

Save Picture As JPEG
Hi,

I can't seem to find a way to draw on a picture control, and have the result saved as a .JPEG or .GIF file. I have been playing with the savepicture method, but can't seem to get it to save what I want.

Thanks for any help,
jeddo

Save Picture As JPEG File?
Is there a way to save a picture oblect as a JPEG file?

Resizing An Jpeg Image Using Picture Box
guys i ned help im new in visual basic so i was hoping that your comments and reply or even answer would be for my level. thanks on advance.

i have three(3) Picturebox

Picturebox1
Picturebox2
Picturebox3

what i will do is place a jepg image in picturebox 1 size is 180x76 pixels(for example)

then place another jpeg image in picturebox2 size is 140x80 pixels (for example)

in picturebox3 i wantto show the jpeg image of picturebox2 with the size of picturebox1 (180x76 pixels)


how can this be done?
thanks

Save Picture As Bitmap Or Jpeg
i am try to save a picturefile as a bitmap or a jpeg but cannot seem to figure out how to do this can any one help!!! i tryed this


VB Code:
Private Sub cmdSave_Click()'Call for the common dialog control to show the save menueDim myPic As String    cdbFile.ShowSave    myPic = frmDraw.Image    Open myPic For Output As #1.bmp        Print #1, myPic        Close #1End Sub


thanks in advance RedAngel

Picture Object To Jpeg String
How can I convert a Picture Object into a string representing a file in jpeg or gif format?

The reason I ask is I wrote a server, (as you may have noticed) that creates a Image saying how many posts of mine that have been read. It really justs counts every request for the image. Anyway I don't like having to use Save my picture using SavePicture then having to open the file, read in the string, then dispatch it to the client.



Edited by - msg555 on 11/24/2004 7:47:10 PM

Saving A Bitmap,Gif Or JPEG Image To An Access 2000 Database
Can somebody help me with this one,

How do you save the contents of the Image Control as an embedded image in an Access 2000 database table, I've tried all weekend and just cannot work it out ?

help !

Open, Rotate And Save Picture As JPEG
ok, I want to itegrate rotating pictures function into my fotoalbum program. I want to rotate pictures for 90 degrees of course.

I'm saving JPEG's directly from picturebox with intels JPEG processor.


I'm rotateing pictures using GetDIBits and SetDIBits functions (and using 2 different pictureboxes - I think it was BillSoo's idea).

The problem is, that I can not save a rotated image.



Do you have any other rotating algorithms?

I've attached this project file.

How Large A Jpeg File Can A Picturebox Picture Contain?
I am trying to load a large map file, Map.jpg, (31MB) into a picture box. A search of vbclassic as well as MSDN help provided no applicable help. I'm using MS Me, a Picture box in a new project and using AutoSize = True


VB Code:
Private Sub Form_Load ()   Picture1.Picture = LoadPicture("c:pathfile1.jpg")End Sub


to load the file at run time. The program runs without error messages and gives a black picture box.

When I loaded the jpg file at design time, the picture box properties showed the height = 171060 and width = 132060. The picture box was black and no error messages occured.

I tried loading a smaller map file (384KB) and a protion of the file displayed OK. In another vb6 app I can scroll the entire 384K map using the cursor keys.

Any help would be appreciated including info on the largest picture file the picture property will hold and display with scrolling.

Thanks

jj2

How To Save The Picture Image In JPEG Format
Hi Everyone,

am developing a picture in the picture box while run time in Visual Basic.I need to save the picture in JPEG format,am not able to do it..It can be saved in BMP format,but not ion JPEG format..

Anyone knows ple let me know how to save the picture image in JPEG format or converting the BMP format to JPEG format

Thanks
Logeswari

How To Store Jpeg,picture In A Sql Server Database ?
Hi,
I need to store picture/image in a Sqlserver table using Ado.How do i code?

Thanks
Gampa

How Can I Save A Picturebox.picture In Jpeg Format
How can a Image displayed in a PictureBox be saved in jpeg format in a file.

How Can I Save A Picturebox.picture In Jpeg Format
How can a Image displayed in a PictureBox be saved in jpeg format in a file.

Creating A Picture Using Picturebox And The Save It In JPEG Format
How do I crate lines or boxes into a picture box and then sve it a an .jpg?

Tnx.

mØrPh

Use Of Picture Boxes - JPEG Image Content, Zoom And A Design Time Query
I wish to use several large picture boxes to display diagram information which is available from JPEG files on my drive.

1. When I load one of these to the picture box, only the top left corner of the JPEG image appears in the picture box. How may I cause the whole of my JPEG image to be visible?

2. Having achieved that, if it is possible (and surely it is) is it then possible to make the picture box zoom in on a particular section of the image such that it can be examined in much greater detail?

3. Finally, I will have about ten of these large picture boxes all placed on top of each other on my form (so that they can be as large as possible). At run time this is no problem because only one at a time will have its visible property set to true, but is it possible to do something similar at design time such that the lower level picture boxes may be edited. At design time it seems that the last box I have placed on the form always stays on top, hiding those placed previously. It is agreat nuisance to have to drag aside all the later placed boxes in order to get at and work on an earlier one.

Suggestions will be gratefully received.

ca moore

Jpeg -> Binary -> String -> Winsock -> Jpeg
Hello,
I'm making a little program which controls the LPT port, and i've connected a webcam to it.
It save's shots as jpeg files in the appdir.
Now i cant get it to send the jpeg file trough winsock to my client!

this is a little bit of my server code:

VB Code:
...Dim FREEout As Integer        FREEout = FreeFile 'load the image into array to be sent        Open App.Path & " mpout.jpg" For Binary As #FREEout            ReDim DATAout(1 To LOF(FREEout))            Get #FREEout, , DATAout        Close #FREEout        If connected Then        Winsock1.SendData DATAout '"[camstream]" & DATAout & EOP 'send the image array        numSENT = numSENT + 1end if        End If...


and this is a little bit of my client code:


VB Code:
...ElseIf label = "ping" Then        If datar = "request" Then        On Error Resume Next        Winsock1.SendData "[ping]response"        End If        End IfElseEnd IfNext iLoopDim FREEin As IntegerIf bytesTotal > "60" Then    If Dir$(App.Path & " mpin.jpg") <> "" Then Kill App.Path & " mpin.jpg" 'delete old file if it exists    FREEin = FreeFile 'open file to save incoming pic data to    Open App.Path & " mpin.jpg" For Binary As #FREEin        Put #FREEin, , sData    Close #FREEin    numREC = numREC + 1    picIN.Picture = LoadPicture(App.Path & " mpin.jpg")    End IfEnd Sub


but (of course) it wont work.
the picIN picturebox stays grey, the tmpin.jpg image is invalid.
but the tmpout.jpg of the server is valid.

So here is my question:
is there a way to load the tmpout.jpg (the binary bits?) into a string, send it trough winsock with my "label", so the client can recognize the label and convert it back to binary and write the tmpin.jpg?

MSFlexGrid Saving Data
hFile = FreeFile
Open resp & "Wrestlers.PM" For Output As #hFile
Write #hFile, (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 0)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 1)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 2)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 3)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 4)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 5)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 6)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 7)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 8)) _
; (MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 9))
Close #hFile

this saves the first line of data, what do i add to the code so it saves all the data in the MSFlexGrid?

Saving/Loading MSFlexGrid To A CSV
I'm working on a graphing program (for something to do....with the eventual (hopeful) end of analysing election results)...anyway...I'm using the MSChart control for my graphs, and a MSFlexGrid for my data input.

I wrote some code to save it to a CSV: (This part works fine and a sample file is included below)

Code:
Dim i As Integer, j As Integer, stringtoprint As String
Open App.Path & "saved.csv" For Output As #1
For i = 0 To chartdata.rows - 1
stringtoprint = ""
For j = 0 To chartdata.Cols - 1
If j = 0 Then
'MsgBox chartdata.TextMatrix(i, j)
stringtoprint = chartdata.TextMatrix(i, j)
Else
'MsgBox chartdata.TextMatrix(i, j)
stringtoprint = stringtoprint & "," & chartdata.TextMatrix(i, j)
End If
Next j
Print #1, stringtoprint
Next i
Close #1

It generates this: (the first cell is always empty)

Code:
,2001,2004,2006
Turnout,62,63,63
So...I want to read the data back in. (My flexgrid always starts out 1 by 1.) This code works, and I expected one extra row and column based on how/when I add them (I can fix that later) but what I didn't expect is extra columns. When I read the above file with the below code, I get 3 rows and 9 columns. I expected 3 rows and 5 columns....not 9. Does anyone have any insight?

Code:
Private Sub cmdimport_Click()
Dim i As Integer, j As Integer, stringgotten As String, values() As String, count As Integer
count = 0
Open App.Path & "saved.csv" For Input As #1
Do Until EOF(1)
[b]If count <> 0 Then chartdata.rows = chartdata.rows + 1[/b]
Line Input #1, stringgotten
values() = Split(stringgotten, ",")
For j = 0 To UBound(values())
'MsgBox chartdata.TextMatrix(count, j)
[b]If j <> 0 And count = 0 Then chartdata.Cols = chartdata.Cols + 1[/b]
chartdata.TextMatrix(count, j) = values(j)
Next j
count = count + 1
Loop
Close #1
End Sub

Edit: Just added the above bolded lines. Down to 2 rows but still 7 columns.
Edit 2: Fixed the second bolded line. It was adding the 4 columns for every row I was adding...which was incorrect and it should only add for the first row. So that is now fixed.

MSFlexGrid - Saving To File
I am using the MSFlexGrid on a payroll application that I am making for my dad. My problem is this: How can I save the data I have entered into a .dat file and also load it back into the cells when the form is reopened each time? If you can give me a basic example, I can most likely figure it out from there. Any help you can give me would be much appreciated!

Thanks!

Editing && Saving From MSFlexGrid
Hi ALL

i have to enter data in a grid (i,e the grid must be editable). I have chosen FlexGrid for the same. Now, the changes the user makes on the grid must be saved to the access database, which I am unable to do ?

I am using ADO to connect to the Database. Can anyone help me with the code for doing the same ??

THANX

plz help me

Saving An MsFlexGrid To File
Is there a quick command that saves the contents of a flex grid to a file? Or do i have to go line by line?

Saving Contents Of A MSFlexGrid!
Greetings,

I have been trying to save the contents of a MSFlexGrid onto a file but seem to be missing something.
I keep on getting a "Subcript out of Range" message at the strData = MSFlexGrid1.TextMatrix(y, x) line.



Here is all the code I have for this event:


Private Sub mnuSave_Click()
Dim strFile As String
Dim intFile As Integer
Dim strData As String


strFile = "c: emp6myfile.txt"
intFile = FreeFile



For x = 0 To MSFlexGrid1.Rows - 1
For y = 0 To MSFlexGrid1.Cols - 1
Next
Next

strData = MSFlexGrid1.TextMatrix(y, x)

Open strFile For Output As #intFile

Print #intFile, strData

Close #intFile


End Sub

Could someone please tell me what it is that I am missing?

Thank you all in advance,

Luke

Copyright © 2005-08 www.BigResource.com, All rights reserved