0
연장 된 DataGridView
입니다. 오른쪽 클릭 옵션 인 "항목 선택"을 사용하여 다른 어셈블리에 대한 참조를 추가하지 않고 도구 상자에 새 컨트롤을 추가하고 싶습니다. 컨트롤은 폼의 같은 프로젝트에 있으며, 나는 그들을 구분하고 싶지 않습니다. 이것을 어떻게 할 수 있습니까?컨트롤이 동일한 프로젝트에있을 때 확장 된 컨트롤을 도구 상자에 추가하는 방법?
감사합니다.
편집 : 사용자 컨트롤이 아닌 경우 사용자 컨트롤에 관한 질문과 중복 될 수 없습니다.
편집 2 : 코드 자체 (이 과정에서 작품의 그것은하지 완성입니다.) :
class BindedDataGrid<T> : DataGridView
{
public BindedDataGrid()
{
InitializeComponent();
IEnumerable<PropertyInfo> properties = typeof(T).GetProperties().Where(p => Attribute.IsDefined(p, typeof(BindingValueAttribute)));
foreach (PropertyInfo property in properties)
{
var column = new DataGridViewColumn()
{
HeaderText = ((property.GetCustomAttributes(true)[0]) as BindingValueAttribute).Value
};
Columns.Add(column);
}
}
}
흠. 프로젝트 구성 요소 중 하나로 정의되기로되어 있습니다. ProjectName_Components 탭에 표시됩니다. UserControl에서 상속 된 확장? –
@o_O -이 질문은 사용자 컨트롤이 아닌 확장 컨트롤에 관한 것입니다. – Sipo
내 잘못, [이 도움이 될 수도] (https://stackoverflow.com/questions/1116311/how-to-put-an-extended-winforms-control-on-toolbox) –