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?
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.
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.
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.
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
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 ?????
Bookmarks