views:

223

answers:

2

I'm trying to write a print layout editor in VB6 or VB.Net, and am looking for some reference articles to help get me started.

The idea is that the editor will be used to define print "areas" for invoice or statement layouts, by allowing the user to draw the box for customer address, invoice number, lines, totals etc. The program will then figure out how to translate the dimensions and positions of the various boxes into print locations to store in the layout definition file, which is later used by an accounts system to print the various reports. Note that for various reasons (chiefly that the accounts system is non-Windows), placing text into Word or similar products and having them print the document is not an option. I can edit the document layout file by hand of course, but it's not very user-friendly.

As you might imagine, searches for "form editor", "layout editor" and the like bring many hundreds of irrelevant results. The frustrating thing is that I have seen a very relevant article, but lost the bookmark.

I am hoping someone has some pointers.

+1  A: 

First of all, you should have great knowledge of the language/APIs you're using, and in fact you really should specify if you're using Windows.Forms, WPF, GTK#, etc. Make sure you're very good on that.

Then, you should think of a format for your form editor to store the forms. Usually, form editors use XML. If you also want to follow that trend, you REALLY should learn a good XML API for VB.

Finally, plan your steps carefully:

  1. Do you want to use the custom text field controls provided by your API, or do you want to draw them manually(if so, then you'll need to learn a drawing API)?
  2. Make sure you understand the layout definition file format very well.

Now, it's the time to start a proof-of-concept: create a simple editor that can load/save forms and add buttons to them. This will probably be hardest step to figure out. You may need to deal with events and several other stuff, but eventually it'll work(if not, then you may ask again). Finally, just add the features you need, such as layout definition file output, new controls, control moving/resizing, etc.

If you need anything else(including more specific instructions), just ask.

luiscubal
A: 

Thanks, this sounds more complicated than I imagined. I really wish I could find the original article I lost, as it was pretty clear on how to go about this in vb.net.

Because it's a layout for a printed form, I think that cuts down the complexity quite a lot - I only really need to store size and position of each print area, along with font, alignment and colour information, and possibly a filename for a graphic if a logo is required. The layout definition file format is entirely under my control.

Mike Edwards