looking for some advice

graphical grid and image

Page 1 of 1

1 Replies - 793 Views - Last Post: 03 December 2010 - 04:34 PM Rate Topic: -----

#1 TADS  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 161
  • Joined: 09-August 08

looking for some advice

Posted 02 December 2010 - 09:41 AM

hi all...

im looking for abit of advice.. i would like to make my Wife a program for Xmas for her cross stitching ....

i would like to make a Pattern creator like the following link...
pattern creator

she would select a image/photo from her laptop import it to the application and it would show the grid behind it so it shows what stitch to put where

there is lots of other Functions but thats one main one

if anyone could advice me how i could go about doing something like this it would be gr8

thanks again


Is This A Good Question/Topic? 0
  • +

Replies To: looking for some advice

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 5201
  • View blog
  • Posts: 13,944
  • Joined: 18-April 07

Re: looking for some advice

Posted 03 December 2010 - 04:34 PM

Its just a matter of have a OpenFileDialog control for her to select her graphic, secondly putting that graphic into an object such as Bitmap or Image, then use Graphics.FromImage(imagevariable) to get a Graphics object to use to draw on the image, draw a cross pattern on it by using the Graphics object's DrawLine() method with equally spaced out X and Y values, store it into a new graphic and lastly call the Save() method of the new Bitmap image to save it.

' Create a new bitmap object using the path to the file (created from your OpenFileDialog)
Dim bmpImg As New Bitmap("file to load path here")

' Create a Graphics object from it
Dim gr As Graphics = Graphics.FromImage(bmpImg)

' Select a Red pen
Dim pen1 As New Pen(Color.Red)

' Draw a line(s) using the red pen from poing x1,y1 to x2,y2
gr.DrawLine(pen1, x1, y1, x2, y2)

' Create a new bitmap out of it using same width and height of original image and provide graphics object
Bitmap bmp = New Bitmap(width, height, gr)

' Save it to disk
bmp.Save("filename here")

That should get you started down the right path to getting this up and running. The next trick will be putting this new gridded image into a format that perhaps her machine will understand (unless you want her just to print it out and do it by hand, either way works).

Enjoy! :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1