Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allowing users to draw the sketches at run-time in visual basic 6.0.

Status
Not open for further replies.

hujur

Programmer
Feb 14, 2003
20
0
0
US
Hello,

I want to give users a list of drawing that are stored in metafiles , so that they can drag the drawing and strech and make a disgram at run-time in visual basic and I want store the entire disgram into access database not as a blob as string or numbers (what ever except blob), may be storing the co-ordinates and then rejoining the co-ordinates when they open the diagram again? Please help this is very crucial for me, am trying since long, but found no way to do it.

Thanks !
 

One of the better ways to store image information in an access database is not to store it in the database but to store the path to the image in the database. To allow the user to "draw" and to display you could use a picture box control.

Good Luck

 
Thanks for the reply !

I want to display the list of diagrams on the side of the form and allow users to drag and drop it on form/picture box.. at run-time and allow them to strech it at run-time. How to do that?

I cannot store the path into database that is not the requirements, I have to store in any other data type except blob. Any other suggestions, please reply.


Thanks
 

Well, with access you have ole object and memo fields to work with. Both can be considered blob fields. As for stretching you can use drag and drop on the corners/edges of the picture box or better yet lines on the form surrounding the picture box.

Good Luck

 
This code will allow you to draw when you click the mouse button down.

[tt]Option Explicit

Dim DrawNow As Boolean

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawNow = True
CurrentX = X
CurrentY = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If DrawNow Then Line -(X, Y)
End Sub


Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawNow = False
End Sub
[/tt]
 
Thanks JeStar,

Thanks for posting the sample code. This is the basic code to just draw, I need little advanced functionalities.

I want to display the list of images at run time and when the user clicks on the image or drags and drop it on the form and then save into the database the co-ordinates of it. Thanks for posting the sample code.

I could not find the way to display the contents of metafiles in the listbox (metafiles has specific diagrams that users need ) and then let them drag and drop it on the form and then save the same diagram in the co-ordinates format, when user reopens it, read the co-ordinates and then draw the diagrams.

If you have any suggestion/smaple code please post it!

Everything helps !

Thanks a lot for replying


Thanks !!

 
I've done this. I'm not going to give you the code as it took me absolutely ages to do.

1) Do you know how to play metafiles? If not take a look at Q113682. It's vb3, so you will have to change the declares etc. Shows you what to do though.
2) The problem with dragging the metafile around is that it isn't really there. It's just drawn on the form. However, to draw it on the form, you need to know where the boundaries of the image are, so you can tell which one you've clicked on. Now you can draw a box round it (use line controls). Now if you click on a line, you can dra the lines and when you let go, re draw the metafile. Use a similar technique for dragging the metafile onto the form in the first place.

Best of luck.

 

petermeachem,

have you ever tried to use the loadpicture function to load an EMF or WMF into a picturebox? LOL

Nice to see you back posting.

 
Thanks for the reply,

I don't need the code but just the little bit more detail suggestion and guidelines to accomplish the task.
The day I will accomplish this task I will post the zip file on this web site with Special thanks to you two for your great help .


Thanks !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top