내가 그의 초기 클래스 정의 ListView 컨트롤과 제네릭을 사용하고는 다음과 같습니다제네릭 ListView에 사용자 지정 컨트롤
partial class CustomListView
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
//protected override void Dispose(bool disposing)
//{
// if (disposing && (components != null))
// {
// components.Dispose();
// }
// base.Dispose(disposing);
//}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
는 내가하고 싶은 것은 다음과 같습니다
namespace BaseControlLibrary
{
public partial class CustomListView<T> : System.Windows.Forms.ListView
{
// Custom fields, properties, methods go here
public CustomListView(List<T> data)
{
_columnInfo = new Dictionary<int, string>();
_columnIndex = 0;
_lvwItemComparer = new ListViewItemComparer();
this.ListViewItemSorter = _lvwItemComparer;
InitializeColumnNames();
BindDataToListView(data);
this.Invalidate();
}
}
}
내 디자이너 파일입니다 Windows 컨트롤 라이브러리를 만들고 성공적으로 수행했지만 도구 상자에 DLL을 추가 할 수없는 경우 문제가 발생합니다. 나는 왜 내가 이것을 할 수 없는지 정확히 알지 못합니다. 모든 Windows Forms 컨트롤이 도구 상자에 항목을 추가하는 데 필요한 IComponent 인터페이스를 구현한다고 생각했습니다. 클래스 정의의 일부로 유형 매개 변수가 있기 때문입니까?
공개 매개 변수없는 생성자가 없을 수도 있습니까? – Zyphrax