10
votes

Slight bit of background: I'm a Delphi programmer re-learning C# (learned in school originally, haven't hardly touched until recently), and am trying to get some of my Delphi concepts transferred over.

The current situation is, I need to create an application that can use data from a variable list of similar data controls depending on location, need, etc. and in order to display that information in Delphi, I would simply use a scroll box and frames. The scroll box I can easily replace with the C# panel class, but I'm not finding anything I can use that will tell me how to create my frame class for use inside the panel. All I can find is some stuff for web development.

Can anyone point me in a good direction for learning the C# frame equivalent? Thanks.

EDIT:

For non-Delphi programmers, a frame is a form-like control that allows other controls (buttons, boxes, grids, etc) to be placed on it, then the frame gets used as a control itself on a form to reduce code-reuse as all frames do similar functionality and streamline development. For a (probably better) more in-depth description, see about.com's or Delphi Basics descriptions.

5

5 Answers

7
votes

EDIT:

For non-Delphi programmers, a frame is a form-like control that allows other controls (buttons, boxes, grids, etc) to be placed on it, then the frame gets used as a control itself on a form to reduce code-reuse as all frames do similar functionality and streamline development. For a (probably better) more in-depth description, see about.com's or Delphi Basics descriptions.

Sounds like a User Control to me.

Here are some tutorials:

WPF

WinForms

6
votes

Having used both Delphi and .Net, I think a UserControl is the equivalent. It's a container that you can add controls to, and then add to other forms in the project.

5
votes

You need to create a custom control that extends the Panel class and then repeat that custom control.

1
votes

I'm not familiar with Delphi, but what you describe sounds a bit like a WPF FlowDocument, or one of the related controls.

1
votes

Any Panel provides the same functionality as Delphi's Frame (a composite containing other controls).

To encapsulate and reuse a panel with specific children, you need to write a custom class (custom control (as Payton mentioned) in WinForms or better yet a new Control in WPF).

I also programmed in Delphi many years ago and I highly recommend using WPF and not WinForms, especially if you are familiar with HTML or XML or you need to write dynamic or data oriented applications.