GUI 表单构建在对象上(如 Propertygrid)

发布于 2024-10-28 04:09:52 字数 211 浏览 2 评论 0原文

我想知道,当我有一个对象并希望能够在 GUI(对话框等)中编辑它时,设计模式是什么。我正在使用 C#.NET...也许 Visual Studio 2008 也有一些集成功能?

通过使用 PropertyGrid,我可以将一个对象附加到它 (.SelectedObject)。我正在寻找类似的东西:让 gui 自动构建附加到它的对象。

任何提示都是非常受欢迎的! 问候,格雷格

I am wondering, what the design pattern is, when I have an object and want to be able to edit it in a GUI (dialogue, etc). I'm using C#.NET... Perhaps there are also some integrated features with visual studio 2008?

By using a PropertyGrid, I can attach an object to it (.SelectedObject). What I'm looking for is something similar: to let a gui automatically build about the object which is attached to it.

Any hints are most welcome!
Regards, Greg

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

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

发布评论

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

评论(3

酒与心事 2024-11-04 04:09:52

您是否正在寻找一个现成的控件库来使用?

它只是文档视图(如果还有控制器,可能在 MVC 上下文中)。

唯一的特殊部分是您有一个特别动态/通用的视图(控件)。

如果你真的坚持,你可以切线提及

  • 观察者模式(用于“观察”所选对象的变化)
  • 访问者模式(用于“访问”所选对象的属性),

但这开始进入完全推测的领域。我什至可能会说“SpaghettiCodePattern”可用于实现此目的。可能会,但不一定如此。

我不认为(有)/(你正在寻找)设计模式

could it be you are looking for a ready-made control library to use?

It would be simply document-view (possibly in a MVC context if there is also going to be a controller).

The only special part is that you have a particularly dynamic/generic view (control).

If you really insist you could tangentially mention

  • observer pattern (for 'observing' the change in selected object)
  • visitor pattern (for 'visiting' the properties of the selected object)

but this starting to get in the realm of complete conjecture. I might even say that 'SpaghettiCodePattern' could be used in implementing this. It might, and it doesn't have to be.

I don't think (there is)/(you are looking) for a design pattern

︶葆Ⅱㄣ 2024-11-04 04:09:52

如果我错了,请纠正我,但我认为 propertygrid 是基于使用反射的。

Correct me if I am wrong, but I think the propertygrid is based on using reflection.

把昨日还给我 2024-11-04 04:09:52

你的问题很笼统。有一种模式称为裸对象模式,您是指类似这样的模式吗?

另请看看这些:
生成 GUI(WinForms 或 WPF)的工具来自班级

Your question is very general. There is pattern which is called naked object pattern, do you mean something like this?

Also have a look at these:
Tool to generate a GUI (WinForms or WPF) from a class

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