在运行时中使用“属性窗口"来自定义窗口表单控件 [英] Using Properties Window in runtime to customize windows form controls

查看:46
本文介绍了在运行时中使用“属性窗口"来自定义窗口表单控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在运行时使用Visual Studio设计时的属性窗口来自定义特定的 Control ,例如 DataGridView ?>

下面的图片需要使用户能够通过更改控件的属性来自定义 Form 上的控件.

解决方案

Is there a way to use visual studio design-time Properties Window at runtime to customize a specific Control such as DataGridView?

Some thing like image below needed to enable user to customize controls on a Form by changing properties of them.

解决方案

The PropertyGrid is a standard control. You can add one to your Form or create it at run-time.
In the ToolBox, it's usually found in the All Windows Forms cathegory, or using the search tool.
It can be fully customized and supports transparent colors.

You can use the SelectedObject property to associate it to an existing control and it will populate automatically (this property can also be set at design-time).

The PropertyGrid can then be used to change the associated control's properties at run-time.

propertyGrid1.SelectedObject = this.dataGridView1;


这篇关于在运行时中使用“属性窗口"来自定义窗口表单控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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