views:

450

answers:

5

What's the best way to draw shapes interactively at run time using Delphi? I need to be able to select, drag and resize the shapes. This will be used to mark up existing images and documents.

This looks like a good starting point, but I'm wondering if there's a more complete library (preferably free) available that will save some time.

Update:

If you're going with a custom solution from scratch, I've seen another example on Delphi Central that might be an even better starting point.

+4  A: 

I will recommend you, read some links on my site. Are explained and all the source code is available; You can see and get some usefull for you.

  • Plugin system in Delphi - Part 2 Not directly what you need, is a plugin system for Delphi. But all the samples are based on a drawing tool that uses Shapes (Creating, selecting, resizing). You can review the code and extract what you need.
    alt text

  • Sample manipulating of "Maps and Figures" Sample of how to create, select and move components at runtime (in this case with TImage).

alt text - Select shapes visually: Shows different ways to select shapes visually.

alt text

The web is in Spanish, but you can generate an authomatic translation on the web itself. Anyway the code is commented.

Regards.

Excuse-me for my bad english.

Neftalí
Excelente aporte Neftalí. Un gusto leerte por estos lares!! :)
jachguate
Un placer verte a tí también Juan Antonio.Un saludo.
Neftalí
Very nice looking components.
Warren P
Since I can not read spanish I could not find the download link. Can you post the source-download link here?
Warren P
Overkill for this project, but I've bookmarked it for future use. thanks.
Bruce McGee
Hello Warren. I have commented that the page has a small assitant for translate it to English (at Right). PLUGING SYSTEM PART 2 ==> (source) http://neftali-mirror.site11.com/articulos/Prototipo2.zip and (binarys) http://neftali-mirror.site11.com/articulos/Prototipo2_exe.zip SAMPLE "MAPS AND FIGURES" ==> http://neftali-mirror.site11.com/ejemplos_files/demo_restaurante.zip SELECT SHAPES VISUALLY ==> http://neftali-mirror.site11.com/ejemplos_files/seleccionar_shapes_visualmente.zip Excuse-me for tha bad format. Regards.
Neftalí
+1  A: 

One freeware option would be TssControlSizer. Just change the "control" property to the control you want to manipulate resize/move.

skamradt
I wound up going with a custom solution, and this was useful.
Bruce McGee
A: 

I would use Flex Graphics (commercial, $499 for one developer, with sources, $1500 for site-license, with source code). When I bought it, it was a lot less than that. So I guess, I wouldn't pay that now. It's a lightweight 'drawing/cad' package.

But as I already own it, I could import a page from the original document as an image, perhaps rendered in PNG or WMF, and then mark it up with lines, etc.

You could think of it as a light "cad" package. It has most primitive shapes, and you can easily create your own new objects or shapes in Delphi classes, that could be "smart shapes" like the ones in Visio.

http://www.flex-graphics.com/

Another commercial component set that I have heard only good things about is TRichView. They have a TRichViewEdit that looks like you could emulate a document markup environment easily with it.

Warren P
Interesting, but WAY too expensive for the problem at hand. On the bright side, it's a little less expensive. $499 per developer (with source)
Bruce McGee
+1  A: 

Not sure if you've moved on now with this Bruce but if you haven't, it might be worth looking at TMS Components Diagram Studio - it's certainly cheap, and looks quite powerful from the demo.

robsoft
Thanks for the link. I like TMS.
Bruce McGee
A: 

Please check here: TCAD -2d graphics component for delphi http://www.codeidea.com wish can help you.