Results 1 to 8 of 8

Thread: Drawing in VB .NET CF

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    8

    Drawing in VB .NET CF

    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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Drawing in VB .NET CF

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    8

    Re: Drawing in VB .NET CF

    Quote Originally Posted by jmcilhinney View Post
    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Drawing in VB .NET CF

    Quote Originally Posted by lewwy View Post
    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    8

    Re: Drawing in VB .NET CF

    Quote Originally Posted by jmcilhinney View Post
    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

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Drawing in VB .NET CF

    Quote Originally Posted by lewwy View Post
    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Drawing in VB .NET CF

    Thread moved

  8. #8
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Drawing in VB .NET CF

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width