Can I do dynamic GUI components like in Java?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

One thing I encountered a problem with when porting some Java code to C# is
that some GUIs in Java all the widgets are basicaly evolved from one class
and it gives you some strange flexibility like adding any component to other
components. Like having a JList you can add ListItems but they can be
anything from combo boxes to labels to even stuff like tables. Is it possible
to do something like this in C#? How do I handle this?
 
MrNobody said:
One thing I encountered a problem with when porting some Java code to C#
is
that some GUIs in Java all the widgets are basicaly evolved from one class
and it gives you some strange flexibility like adding any component to
other
components. Like having a JList you can add ListItems but they can be
anything from combo boxes to labels to even stuff like tables. Is it
possible
to do something like this in C#? How do I handle this?

You probably need to ask a much more specific question, and you probably you
need to spend some time learning how Windows Forms works. For a WinForms
application, the entire UI is built dynamically, creating controls at
runtime and gluing them together to form the UI - just take a look at the
"designer generated" code in YourForm.Designer.cs.

Since I don't know exactly what a JList is, I can't tell you exactly where
to look for the equivalent, but I'd guess that it's something like a
TableLayoutPanel in windows forms (but unless JList has a lot more
functionality than the name suggests, TLP probably does quite a lot more).

-cd
 
Back
Top