| | |
Saving contents of an ink picture control?
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: May 2009
Posts: 40
Reputation:
Solved Threads: 0
I'm using the ink picture control and I'm having trouble getting my code to work. The inkpicture control is used for tablet pcs when the user draws inside the control. I just want to be able to save it to a jpeg. I've been stuck on this for days
VB.NET Syntax (Toggle Plain Text)
Dim inkBounds As Rectangle With inkBounds .X = 0 .Y = 0 .Width = InkPicture1.Width .Height = InkPicture1.Height End With Dim img As Image img.Save(IO.Directory.GetCurrentDirectory() & "\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
I don't have a tablet PC to test with, but if things work in the same way as with WinForms, your code should be following
The code saves the image from the InkPicture1 control, not from the rectangle. I wasn't sure which one you actually wanted to save.
HTH
VB.NET Syntax (Toggle Plain Text)
InkPicture1.Image.Save(IO.Directory.GetCurrentDirectory() & "\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
HTH
Teme64 @ Windows Developer Blog
Ok, here's a step-by-step test which control is not set
Put a message box or breakpoint on both Else parts to see if the InkPicture1 or InkPicture1.Image is not set. Can't think that something else could cause that error. This is without seeing more of your code. My guess is that you haven't assigned any initial image to InkPicture1.Image or you've somehow "lost" InkPicture1.Image in your code. In WinForms the image can be assign, for example, in the following way
HTH
VB.NET Syntax (Toggle Plain Text)
If InkPicture1 IsNot Nothing Then If InkPicture1.Image IsNot Nothing Then InkPicture1.Image.Save(IO.Directory.GetCurrentDirectory() & "\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg) Else ' InkPicture1.Image is nothing End If Else ' InkPicture1 is nothing End If
InkPicture1.Image = Image.FromFile("D:\test.jpg") , but I don't know how you do it with Tablet PC.HTH
Teme64 @ Windows Developer Blog
•
•
Join Date: May 2009
Posts: 40
Reputation:
Solved Threads: 0
Okay I put that code and breakpoints that you suggested in there and it looks like the InkPicture1.image is what its stopping at. I tried doing something like this
but that didnt seem to help. Thats all my code i don't have any more. I still keep getting that exception and I'm still new with vb and the inkpicture
VB.NET Syntax (Toggle Plain Text)
If Inkpicture1.Ink.Strokes.Count > 0 Then Inkpicture1.Image.Save(IO.Directory.GetCurrentDirectory() & "\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg) End If
but that didnt seem to help. Thats all my code i don't have any more. I still keep getting that exception and I'm still new with vb and the inkpicture
I did some googling and found out that InkPicture control does not even have Image property 
InkEdit control has SaveFile method (see Using InkEdit, InkPicture, and Enhancing the Appearance of Ink).
InkPicture doesn't seem to have any methods for loading and saving it's content, but I found the following article: Save InkPicture image with Ink in common image formats. The code snippet is written in C# but it's quite straight forward to convert it to VB. If you're not familiar with C#, use Convert C# to VB.NET for code conversion.
HTH

InkEdit control has SaveFile method (see Using InkEdit, InkPicture, and Enhancing the Appearance of Ink).
InkPicture doesn't seem to have any methods for loading and saving it's content, but I found the following article: Save InkPicture image with Ink in common image formats. The code snippet is written in C# but it's quite straight forward to convert it to VB. If you're not familiar with C#, use Convert C# to VB.NET for code conversion.
HTH
Teme64 @ Windows Developer Blog
![]() |
Similar Threads
- image in picture control not displayed properly after moving (C++)
- picture controls (Visual Basic 4 / 5 / 6)
- problem of loading picture (Visual Basic 4 / 5 / 6)
- saving contents of JEditorPane (Java)
- Saving and opeing a JTable (Java)
- Saving a file using C++ (C++)
- Backp/Restore HardDisk Image (C++)
Other Threads in the VB.NET Forum
- Previous Thread: HttpWebRequest in Windows Service
- Next Thread: Problems Connecting To a SQL Database
| Thread Tools | Search this Thread |
"crystal .net 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net eclipse editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer transparency txttoxmlconverter upload useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml





