'About custom control usage

I want to understand its logic and to modify. This library is refactored based on the open source library. I'm not very familiar with customization. Of course, I'll study hard.

How is it created automatically?

How is it grouped with controls, and where are properties controlled?

The Library: https://github.com/kelicto/KeLi.TreeListViewKit

How to Test: create a new form and add a TreeListView control.



Solution 1:[1]

Not sure i fully understand the question but:

WindowsForms comes with a UI design via Visual Studio. Users drag controls from the designer onto the target form. Each component on the form is clickable, and there is an associated Properties window; this is where values for the properties can be altered. The code in InitializeComponent, whether it be a form, or a custom control is automatically generated by the forms designer. e.g.: when you first start up there is a blank small form with no components.

Drag a textbox control from the left hand side and place it on the form. The form now contains a textbox. Click on the textbox and you can alter the properties of the textbox (name, value, width, even event handlers). Each change will alter how InitializeComponent works.

So if you wanted this custom component on your form you will need to compile the assembly it belongs and add the assembly so it can be referenced by the forms designer. Once this is done your TreeView component will be available to be dragged & dropped onto the form. Do this and you will also be able to set its properties.

Even custom components come with a designer piece; so if you were designing a component from scratch you could still drag / drop components onto that custom control and same as a form the implementation of InitializeComponent will change according to the components dropped, and the properties you set (and their location, anchoring etc which can be done on the main forms designer). I wouldn't recommend building a WindowsForms app without the designer, not that it cannot be done; ultimately it's code at the end of the day. But it's a lot more awkward to do without the visual designer component.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user177933