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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Designer Application...

Status
Not open for further replies.

FOR111

Programmer
Sep 29, 2005
103
MT
Hi All

I have an application and one of my clients asked me if he could personalise the form. I told him that once it's compiled it cannot be changed.

Now i would like to create a form designer, where the form, and components values are stored in the database. Once it is stored, the application will load the values and will set the form accordingly!

Can anyone tell me from where to start off... especially for the designer!

Thanks
Nick
 
When you say Personalize, I assume you mean - re-arrange the controls on the form?

If you look at MS Office Toolbars, they are customizable and moveable. I would create controls similar to that.

Example:

You have a list of names on the left, and a panel with their details on the right. The user wants to re-arrange that so the list is on the right and the details panel is on the left.

You could create a panel that allows you to drag objects and automatically dock them to the appropriate side.

OR

You could create a small dialog that gives them the optional layouts. When they select a layout they like, re-configure the layout in code. lstNames.Dock = DockStyle.Right; pnlDetails.Dock = DockStyle.Fill;

Hope that gives you some ideas
 
Here are some links to get you started. None of these solutions are complete but it should give you what you need to get started.


In addition to the ones listed above there is an open source designer available from Microsoft but I could not find it again. The Project/Solution name is MSHOSTDESIGNER and I would recommend looking for this code as it is the most complete of the three it just left out some of the code you can swipe from the divil.co.uk solution.

I am in the process of finishing off my own designer for an app and I toyed with a couple of solutions.

Simple - Host your form in the designer and limit access to new controls, allow users to hide/unhide, and move controls. This is the easist to deal with changes.

Complex - Build your own library of controls with properties such as Format, Required, etc... Now use Typed Datasets and allow the user to do their own databinding and then control all the complexities of the business logic. You could then allow users to pick from your custom controls, extend with datagrids etc..

The Microsoft solution, that I could not find, has some good information to get you started in serializing/deserializing your form changes to the database. This is not a complete solution, but it will get you started.
 
You're opening a real can of worms with that. I had a similar task when I went to create a report designer for my application. I literally had to write all the GDI+ code to give visual cues for moving and sizing controls, including drag and drop functionality. If I remember correctly, there is a property designer or something like that which was handy for allowing the user to change fonts and colors of your controls and such. However, I abandoned the entire project when I ran into the mammoth task of SubReports, or in your case SubForms. Do you render the subform on designing the parent form? Do you allow them to edit the design of the subform? How should you link the two? What about sums (totals)? The questions go on and on and it just became too much for me to handle in the amount of time I had (and I had plenty). It gave me a deep respect for features like MS Access's form and report designers.
 
While this project is not for the faint of heart, it is not a bad idea to include in all or most of released applications; it is one way to differentiate yourself from the competition. I have spent about 80 hours getting my solution to beta, but a more experienced programmer may take far less time.

The can of worms you choose to open is based on the functionality you wish to provide your users. The more functionality you provide, the more you have to deal with the possibility that your end users could break your working and functional code. I would suggest limiting functionality and providing a sandbox that provides users with the simplist of solutions. I started by implementing the "complex" solution listed above, but it was way beyond the projects budget, so I ended up writing the "simple" solution that provides the user with the ability to make controls visible/invisible, move around, add labels, change labels, and set the formatting method used for text boxes. Users can also change the tab order but they can not add any old control and they can not delete a control from the form. As stated earlier you may want to add properties like Required, Default, etc.. to your custom controls to enhance the solution.

Many of the problems stated by keyser456 are not an issue because you get to use the designer capabilities deployed with the .Net framework and most of the hardwork is already done for you. All you need to do is provide the glue.

The link to the Microsoft solution is here

Also a link to blog I just found with additional information related to this task is here
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top