tags:

views:

89

answers:

3

I'm starting my first C# project, and I want to make a "form designer" (like the one in VS).

The idea is, there will be a visual form designer with a limited toolbox, which will generate Python code (later more) to create the same form.

Problem is, I have no idea how to even get started. First of all, I have the form designer in VS: how do I make a "form-within-a-form?"

Next... I have no idea how complicated this is going to be. I suppose I could just make little boxes appear beside each control created on the form when it is clicked, for resizing, and make a textbox appear on it when double clicked or something, to change the text in it... Things like this.

So another thing I would like to know is this:
I do have programming experience in C and C++, I've done PHP for a number of years and am starting with Python as of recently. I've generated forms dynamically in VB6. Given this experience, am I in way over my head with this project?

+2  A: 

It sounds like you're aware it's non-trivial for a C# first-timer. If you keep it pretty simple, it sounds like you're heading in the right direction (although a web-based form designer might be easier).

SharpDevelop would be an example of a full-featured IDE that can be re-purposed, but that's way over the top.

Good luck!

machine elf
Any idea how I would draw a form within a form, such as in the VS form designer? Right now I am playing with the idea of having an MDI parent window and child windows will be "editable"... which might work I suppose
Carson Myers
@Carson the VS Form Designer does not allow you to place/draw a Form visually inside another Form at Design-Time : in the MDI model you have to set the MdiParent in code, and you will not "see" the MdiChild Form until you execute the program. UserControls, and even "derived controls" that descend from WinForms controls like TreeView and ListView : those will show up in the Design-Time toolbox : but not Forms. Yes, of course, at run-time, you can move around MdiChild Forms you've created, however.
BillW
right, this is what I was thinking. Have a look at the link in the accepted answer -- this is sort of my goal, it was written in C# -- can this be done with the form designer or is that just an MDI setup that has been tweaked?
Carson Myers
Of the 3 projects mentioned, the only open source project and the only one that didn't include a caveat about the user experience/capabilities was SharpDevelop. (I can't say for sure, but maybe you could even take advantage of it's ability to generate WinForms+Python). Experimental samples from Code Project may turn out to be a little too dicey for you if you have a deliverable...
machine elf
+2  A: 

this looks like a really good place to start. It has a pretty good example to get you started. You can even download his source (registration required).

Joel
Great, I will have a look at this code. I'm sure I'll be able to figure it out from this -- thank you
Carson Myers
+1  A: 

For most people starting out in C#, this project would be too much. With your VB6 background, you may be able to pull it off, though.

Here's a hint: the Visual Studio Windows Forms designer draws controls on its surface - by asking the controls to draw themselves.

John Saunders
I have done something similar in VB6, where forms were generated based on scripts. I was just confused about putting forms in other forms -- not exactly sure how to interpret you last point, I guess it will come clear once I understand a bit more about the process.
Carson Myers
@Carson: you asked how to draw on the form - I replied that you should get the controls you place on the form to draw themselves. Become very familiar with the methods and properties of the `Control` class.
John Saunders
Alright I shall, thanks for the advice
Carson Myers