Need guidance: workspace & reflection
-
Hi, I'm a Java programmer and I know a bit of C# (let's say all the fundamentals and perhaps a bit more), however, I still lack a lot of experience on the field of programming form-applications. I have a concept for something of a Microsoft PowerPoint-like application. My problem is: I don't know how/where to start on building the framework for the GUI. When the program is running, the user should be able to drag and drop controls (text, buttons, ..) on the workspace, and my idea was to render them using reflection (does anyone know a 101 on this?). Is there a good starter kit for building 'workspace' applications? Your help is very much appreciated. - A young C# programmer
-
Hi, I'm a Java programmer and I know a bit of C# (let's say all the fundamentals and perhaps a bit more), however, I still lack a lot of experience on the field of programming form-applications. I have a concept for something of a Microsoft PowerPoint-like application. My problem is: I don't know how/where to start on building the framework for the GUI. When the program is running, the user should be able to drag and drop controls (text, buttons, ..) on the workspace, and my idea was to render them using reflection (does anyone know a 101 on this?). Is there a good starter kit for building 'workspace' applications? Your help is very much appreciated. - A young C# programmer
Hi, I dont see the need to use reflection for this. You can build a simple draw application by having a panel (initially empty) and some user interface operations (mouse clicks and drags, and/or keyboard input) that cause new graphical objects to be created, positioned, moved, resized, etc. That would take an internal representation of your drawing (say user-defined objects stored in an ArrayList), a paint method that knows how to paint them all, and a Panel.Invalidate() every time you change the drawing. Similarly you can make something like a form designer inside some container (a Form, or again a Panel): with similar user interface operations you can create, position, move, resize, etc normal Controls. You may not need to hold your "form design" in an ArrayList this time, you could simply add all new Controls to the Form.Controls or Panel.Controls collection that is already there. Also the painting is automatic for all controls inside the Controls collection, so the only thing not to forget is calling Invalidate(). You may find some examples on CodeProject, I suggest you search for "Form Designer". Hope this helps. :)
Luc Pattyn [My Articles]