在 Designer 环境中编辑自定义控件或面板 [英] Editing Custom Controls or Panels in the Designer environment

查看:50
本文介绍了在 Designer 环境中编辑自定义控件或面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个继承 System.Windows.Forms.Panel 的自定义控件,并添加了一些额外的属性.然后我打算创建继承这个自定义面板类的子类,并向它们添加内容.

I have created a custom control that inherits System.Windows.Forms.Panel, and adds a few extra properties. I then intend to create child classes that inherit this custom-panel class, and add content to them.

自定义面板类将作为各个步骤的内容传递给向导"框架(带有后退/下一步按钮).我打算广泛使用它,为威世智创建 40-50 个不同的页面来处理我项目中的各种事情.

The custom-panel class will be passed to a "Wizard" framework (with back/next buttons) as the content for the various steps. I intend to make extensive use of this, creating 40-50 different pages for Wizards to handle various things in my project.

问题:有没有办法在设计器中只查看面板,并从那里修改其布局和设计?我可以用困难的方式编写所有代码,但我真的不想.

Question: Is there a way to view just the panel in the Designer, and modify its layout and design from there? I could code everything the hard way, but I really don't want to.

我进行了一些搜索并找到了这篇文章,但这讨论了创建一个自定义控件并将其添加到库中.我不需要这样做,我只是想直接在 Designer 中查看/编辑控件,而无需将其添加到表单中.

I did some searching and found this article, but that discusses creating a custom control and adding it to a library. I don't need to do this, I just want to view/edit the control in Designer directly, without adding it to a Form.

推荐答案

再次为救援提供明显的答案.

Obvious Answer to the rescue again.

创建自定义控件,根据需要添加布局/拆分面板,并将其属性更改为 DockStyle.Fill.

Create a custom control, add the layout/split panel as desired, and change it's property to DockStyle.Fill.

只要您将所有其他控件添加到布局控件,这将使您的自定义控件表现"得像布局控件.

This makes your custom control "behave" like the layout control, as long as you add all other controls to the layout control.

这篇关于在 Designer 环境中编辑自定义控件或面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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