Hossein Golshani
Hossein Golshani

Reputation: 1897

Using Properties Window in runtime to customize windows form controls

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.

enter image description here

Upvotes: 1

Views: 1219

Answers (1)

Jimi
Jimi

Reputation: 32248

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;


Property Grid Control

Upvotes: 7

Related Questions