-
July 6th, 2006, 04:18 PM
#1
Simple Vector Drawing Application
Hi friends,
Searched the internet for almost a week, but could not find a single simple example of vector drawing capabilities in Visual Basic 6.0.
The program flow is simple.
1. Draw vector shapes (Lines, rectangles, Bezier curves) in run time.
2. Selecting the shapes.
3. Modify the shape in real time.
Can you help me in developing this simple but brain teasing application??
Thanks in advance.
Keep smiling
-
July 6th, 2006, 05:24 PM
#2
Re: Simple Vector Drawing Application
Welcome to CodeGuru!
I think the stuff you want to do is best done via win32 API. I'd first recommend looking at AllApi.net, and get the free Guide and the Viewer. It can take awhile to become comfortable with the API and how to use them, but once you get going, it quickly gets easier.
Also, check out PlanetSourceCode.com for example projects. I'm sure there's plenty you will find useful there as well.
Take your time with this one. It's not a simple one-week application. You may also find a project in progress by Rich2189 to be very helpful. Many of the basic concepts you'll be using are discussed in those threads at length.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
July 6th, 2006, 06:38 PM
#3
Re: Simple Vector Drawing Application
Thanks Wizbang,
I have been using APIguide since last year. OK, there are lots of functions to display graphics. But designing a vector graphics application requires much more depths of intelligence. I had thought of designing a drawing surface consisting of multiple layers with vector element assigned to each of a different layer, but things were getting more complicated. Right now I am working like this:
1) Writing first to memoryDC
2) Storing location points into vector array.
3) Displaying it to the PictureBox.
The problem is with dragging/ translating the vector surfaces. I will code more intensively to find the solutions.
Let me know if you find some useful links for VB6.
Where can get Rich2189 threads?
-
July 6th, 2006, 08:04 PM
#4
Re: Simple Vector Drawing Application
I am in the middle of developing a system like what you want to do. I know what you mean about taking you a week and still no info.
This is what you need to do:
1. When you draw you need to save your objects in a CollectionBase so you save the object you drew on the PictureBox (I assume).
2. Widen the GraphicPath (so you can detect when the mouse is over a line. If it other than line you dont have to winden)
3. When you click on the object (mouse down event handler) loop the collectionbase and test for mouse-object intersection using Isvisible.
4. Bingo...now you knew which object was selected and you can do whatever you want, resize it, delete it, change its attributes...etc
I dont have any code to give you right now. As I said, I just started my program. Hopefully, soon I will post the code.
I hope that helped. Also, visit this site http://www.bobpowell.net it is a great GDI+ site.
Finally, Please share with us your code when you have it working
-
July 7th, 2006, 01:19 AM
#5
Re: Simple Vector Drawing Application
-
July 7th, 2006, 01:24 AM
#6
Re: Simple Vector Drawing Application
Great Links!
-
July 7th, 2006, 02:28 AM
#7
Re: Simple Vector Drawing Application
Hi SamerAZ,
I am using GDI+ with Visual Basic 6.0. I had visited Bob Powell article. It requires VB.Net. I want to do this application in VB 6.0. No doubt, we have to store the graphics object in a collection array. I will post the progress as soon I finish each functional step. Thanks.
Hi HanneSThEGreaT,
I studied the links you you posted. Well drawing is not the problem. Storing the drawings in transparent layers, and selecting the layer for manipulating the vector drawing is what required. Vector Graphics ActiveX control is a very good control, but we have to write the code from scratch. Thanks and stay in touch.
-
July 7th, 2006, 04:36 AM
#8
Re: Simple Vector Drawing Application
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
July 7th, 2006, 05:42 AM
#9
Re: Simple Vector Drawing Application
Hi WizBang,
Thanks for the threads. Seems important. Just gone through the image manipulation thread.
I have surfed another site : Hope it will help others involved in visual basic graphic programming:
http://edais.mvps.org/Tutorials/index.html
-
July 7th, 2006, 09:06 AM
#10
Re: Simple Vector Drawing Application
You probably already do this but heres a tip, if you have any mathamatical functions always work out some test examples on paper, then code a test function. Test the fucntion till your fingers fall off. Then and only then put it into your main code.
@Wiz, progress well i'm coding hard just to stay still, I keep finding new ways to code whole sections. So im not actually getting anywhere just making what I have better .
Rich
Visual Studio 2010 Professional | Windows 7 (x64)
Ubuntu
-
August 23rd, 2006, 04:28 PM
#11
Simple Vector Drawing Application
Hi everybody!
A lot of days have passed while developing this vector drawing application.
Wizbang, If you are there, you had said right.. This is not a one week application. Studying lot of GDI+ examples, applying various logics, I am near to complete this application. Well, the application can now:
1) Draw lines, curves, ellipses, rectangles, polygons.
2) Store all these in Path collection.
3) Perform hit test.
4) Drag the object, Rotate the object, modify the nodes in curves by dragging,deleting, adding the nodes. Paths can be deleted and added.
5) Now comes the difficult task:
Scaling The Matrix.
Well, Scale method of the matrix takes horizontal scale factor and vertical scale factor. If we want to double the size of say rectangle in horizontal direction, we send a value of 2 to the scaleX factor. But I want to gradually increase the value from 1 to 2 depending on the dragging of RESIZING HANDLE using MouseMove event. The code is working perfect if I send the value 2 directly in MouseUp event. But when I send the gradual values using the MouseMove event, the scaling gets on doubled at each pixel difference.
Anybody out there who has worked out a similar problem while scaling objects in individual directions ?????
Keep smiling.
mahesh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|