Visual Studio 中没有父窗体的设计面板 [英] design panel without parent form in Visual Studio

查看:68
本文介绍了Visual Studio 中没有父窗体的设计面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人想出一种方法,我可以在没有表格的情况下设计面板吗?

Anyone come up with a way that I can design a panel without a form?

从表面上看,用户控件似乎不是要走的路.

On the surface usercontrol doesn't seem the way to go.

背景:我来自文本编辑器世界,VS 对我来说是新手.我们用面板而不是表格做所有事情.所以开放学习.具体有一个基类面板 (ExtendedPanel),它定义了一些基本控件:取消、保存、保存和关闭.然后,此 ExtendedPanel 将用于绑定到 bindingsouce clientBindingSource 的 ClientExtendedPanel.这一切都与我的实体框架模型有关.所以我将为我的客户表添加、编辑和删除 sql 数据行.如果保存按钮没有发生任何更改,则不会启用.如果我进行更改但点击取消,它会警告我.我以前做过这一切,但自从我离开那家公司后,我无法访问代码库,而且他们没有使用 VS(仅限文本编辑器),因此无论如何它都不是真正可移植的.

Background: I come from a text editor world and VS is new to me. We did everything with panels instead of forms. So open for learning. Specifically have a base class panel (ExtendedPanel) that defines some basic controls: Cancel, Save, Save and Close. This ExtendedPanel then will be used for ClientExtendedPanel that is tied to a bindingsouce clientBindingSource. This is all tied to my entity framework model. So I will add, edit and delete sql datarows for my Client table. If no changes have happened by Save button will not be enabled. If I make a change but hit cancel it will warn me. I've done all this before but since I left that company I don't have access to the code base and they didn't use VS (text editor only)so it wasn't really transportable anyway.

所有这些背景,所以我可以问:usercontrol 是要走的路,还是有什么东西可以让我直观地向面板添加控件,就像它是一个表单?

All that background so I can ask: Is usercontrol the way to go, or is there something that will allow me to visually add controls to a panel like it is a form?

推荐答案

是的,UserControl 在设计器中提供了一个类似于表单的画布,供您添加其他控件(按钮等).

Yes, a UserControl provides a form-like canvas in the designer for you to add other controls (buttons, etc).

也可以通过继承面板并编写代码来添加按钮和连接它们的事件等来完成此操作,但您不会获得设计器的支持.

You can do this too by inheriting a panel and writing the code to add the buttons and wire their events, etc, but you won't get the designer support.

这篇关于Visual Studio 中没有父窗体的设计面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆