Click to See Complete Forum and Search --> : Drawing in VB .NET CF
lewwy
Mar 10th, 2010, 06:44 PM
Hi All,
I'm making a program that gets a client to sign off when a job is done. What I want to be able to do is create a drawing object somehow on the form, and then when the user taps next the contents of that object are saved to a JPG file for use in paperwork (thats in HTML format as well). So how would I go about doing this? I wouldnt even know what control to use :(
Thanks!
Lewis
jmcilhinney
Mar 10th, 2010, 06:53 PM
If you're using standard Windows Forms, you would use a PictureBox and handle its MouseDown, MouseMove and MouseUp events. You'd record the start point, end point and all the recorded points in between and draw the result on the PictureBox. To save, you'd transfer the drawing to the Image in the PictureBox and then call its Save method.
Follow the CodeBank link in my signature and check out my Simple Drawing thread. It's not exactly what you want but very close. You just need to decide how to draw what's recorded:
1. Draw it as a series of dots by calling DrawRectangle multiple times with a 1x1 rectangle.
2. Draw it as a series of lines between each pair of locations.
I'd probably go with the second option.
lewwy
Mar 10th, 2010, 06:55 PM
If you're using standard Windows Forms, you would use a PictureBox and handle its MouseDown, MouseMove and MouseUp events. You'd record the start point, end point and all the recorded points in between and draw the result on the PictureBox. To save, you'd transfer the drawing to the Image in the PictureBox and then call its Save method.
Follow the CodeBank link in my signature and check out my Simple Drawing thread. It's not exactly what you want but very close. You just need to decide how to draw what's recorded:
1. Draw it as a series of dots by calling DrawRectangle multiple times with a 1x1 rectangle.
2. Draw it as a series of lines between each pair of locations.
I'd probably go with the second option.
Thanks for your prompt response, but this is actually for .NET Compact Framework? Does this still stand? I'll check out the codebank thing anyway.
jmcilhinney
Mar 10th, 2010, 07:05 PM
Thanks for your prompt response, but this is actually for .NET Compact Framework? Does this still stand? I'll check out the codebank thing anyway.This site has a .NET Mobile forum, so if you want mobile-specific advice then you should be posting there. I did notice that you specified the CF. I would assume that everything I have said would be applicable but I'll leave it up to you to check whether all the required types and members are supported.
lewwy
Mar 10th, 2010, 07:06 PM
This site has a .NET Mobile forum, so if you want mobile-specific advice then you should be posting there. I did notice that you specified the CF. I would assume that everything I have said would be applicable but I'll leave it up to you to check whether all the required types and members are supported.
Ok cool, thanks for your help I'll give that a go. If it doesn't work I'll specify this thread to be deleted and then start a new thread over in the .NET CF area. Thankyou :)
jmcilhinney
Mar 10th, 2010, 07:08 PM
If it doesn't work I'll specify this thread to be deleted and then start a new thread over in the .NET CF area.Just ask the mods to move the existing thread. The easiest way is to click the Report Post link at the bottom of your post and then ask there. That message will go to all mods.
penagate
Mar 10th, 2010, 07:49 PM
Thread moved
petevick
Mar 11th, 2010, 12:09 AM
Hi,
jmcilhinney's still stands in .Net CF - use a picture box to draw on , and then save it as a jpg. Use mousedown, mouseup and mousemove events. Alternately there are 3rd party signature boxes out there. Alternately an article and some code I wrote ages ago are here (http://forums.devbuzz.com/m_40329/mpage_1/key_signature/tm.htm#40790)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.