?
Solved

Saving Ink Pictures

Posted on 2009-07-16
14
Medium Priority
?
407 Views
Last Modified: 2013-11-05
I'm using the ink picture control and I'm having trouble getting my code to work.  I think I'm on the right track but I just cant figure it out.  Please help me I've been stuck on this for days. Thanks in advance  :)
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)

Open in new window

0
Comment
Question by:lolwtf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24876985
I dont know what you are trying to do but the following lines would definitely produce error
Dim img As Image
img.Save(IO.Directory.GetCurrentDirectory() & "\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

And the error would be "Object reference not set to an instance of an object".

Please explain what you are trying to do.
0
 

Author Comment

by:lolwtf
ID: 24878233
I'm using the ink picture control, something you would use on a tablet pc.  Basically all i want to do is save the contents of the ink picture to a jpeg.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24878262
Do this
InkPicture1.Image.Save(IO.Directory.GetCurrentDirectory() & "\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24878268
0
 

Author Comment

by:lolwtf
ID: 24878381
Okay I tried the line of code that you provided but still not having any luck.  Ive downloaded the tutorial, but the problem is he saves it as  a rtf file and not a jpeg.  Doing that only allows you to view the picture inside the program.  
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24878417
Well try this as a test

InkPicture1.Image.Save("C:\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
0
 

Author Comment

by:lolwtf
ID: 24878481
I keep getting an object reference not set to an instance of an object exception.  Do you think the rest of the code is right?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24878530
From the code you have given above in the question, DELETE EVERYTHING. You do not need any of that.

Just use this like and make sure the name of the control is correct and it exists.

If Not Isnothing(InkPicture1.Image) Then
   InkPicture1.Image.Save("C:\test_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
Else
   Messagebox.show ("No image!")
End If
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24878559
The above code would probably show you the messagebox, then try the following link

http://weblogs.asp.net/nleghari/archive/2004/08/04/207583.aspx



0
 

Author Comment

by:lolwtf
ID: 24878622
It just keeps giving me exceptions.  The name of the control is correct and everything should work.  I'm wondering since its a windows xp tablet software control, if its vista that's screwing up
0
 

Author Comment

by:lolwtf
ID: 24878629
Ive never done C# before so ill try my best to try and convert it
0
 

Author Comment

by:lolwtf
ID: 24878776
Lol sorry i still need a little help.  I dragged and dropped a savefiledialog on my form and converted the C# code this far:
Dim r As New Renderer
        Dim b2 As Bitmap
        Dim g1 As Graphics
 
 
 
 
 
 
 
 
        If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
 
 
 
            r.Draw(g1, InkPicture1.Ink.Strokes)
 
 
        End If
 
 
 
 
    End Sub

Open in new window

0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 24878877
Use the following free online tool to convert C# to VB

http://www.developerfusion.com/tools/convert/csharp-to-vb/
0
 

Author Closing Comment

by:lolwtf
ID: 31604417
Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question