如何用C#做类似Delphi的框架?

发布于 2024-08-22 17:40:34 字数 653 浏览 3 评论 0原文

一点背景知识:我是一名Delphi程序员,正在重新学习C#(最初是在学校学习的,直到最近才几乎没有接触过),并且正在尝试将我的一些Delphi概念转移过来。

目前的情况是,我需要创建一个应用程序,该应用程序可以根据位置、需要等使用类似数据控件的变量列表中的数据,并且为了在 Delphi 中显示该信息,我只需使用滚动框和框架。我可以轻松地用 C# 面板类替换滚动框,但我没有找到任何可以使用的东西来告诉我如何创建在面板内使用的框架类。我所能找到的只是一些用于网络开发的东西。

谁能为我指明学习 C# 框架等效项的好方向?谢谢。

编辑:

对于非Delphi程序员来说,框架是一个类似表单的控件,允许在其上放置其他控件(按钮、框、网格等),然后框架本身用作表单上的控件以减少代码- 重用,因为所有框架都具有类似的功能并简化开发。有关(可能更好)更深入的描述,请参阅 about.com Delphi 基础知识 说明。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

緦唸λ蓇 2024-08-29 17:40:34

编辑:

对于非 Delphi 程序员来说,框架是
类似表单的控件,允许其他
控件(按钮、框、网格等)
放在上面,然后是框架
用作控件本身
表单以减少代码重用
框架具有类似的功能并且
简化开发。对于一个
(可能更好)更深入
描述,请参阅 about.com 或 Delphi
基本描述。

对我来说听起来像是一个用户控件。

以下是一些教程:

WPF

WinForms

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

婴鹅 2024-08-29 17:40:34

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.

戈亓 2024-08-29 17:40:34

您需要创建一个扩展Panel 类的自定义控件,然后重复该自定义控件。

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

溺孤伤于心 2024-08-29 17:40:34

我不熟悉 Delphi,但你所描述的听起来有点像 WPF FlowDocument,或相关控件之一。

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

浮云落日 2024-08-29 17:40:34

Any Panel 提供与Delphi 的Frame(包含其他控件的复合体)相同的功能。

要封装和重用具有特定子项的面板,您需要编写一个自定义类(WinForms 中的自定义控件(如 Payton 提到的),或者更好的是 WPF 中的新控件)。

许多年前我也使用 Delphi 进行编程,我强烈建议使用 WPF 而不是 WinForms,特别是如果您熟悉 HTML 或 XML 或者您需要编写动态或面向数据的应用程序。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文