editors.cs
来自「语音视频功能 里面实现了基本的QQ与语音对话」· CS 代码 · 共 84 行
CS
84 行
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.ComponentModel.Design.Serialization;
namespace gowk.controls
{
/// <summary>
/// GListViewItemCollectionEditor 的摘要说明。
/// </summary>
public class GListViewItemCollectionEditor :System.ComponentModel.Design.CollectionEditor
{
public GListViewItemCollectionEditor(Type type):base(type)
{
}
protected override Type CreateCollectionItemType()
{
return typeof(GListViewItem);
}
protected override object CreateInstance(Type itemType)
{
return new GListViewItem();
}
}
public class GListViewFolderCollectionEditor :System.ComponentModel.Design.CollectionEditor
{
public GListViewFolderCollectionEditor(Type type):base(type)
{
}
protected override Type CreateCollectionItemType()
{
return typeof(GListViewFolder);
}
protected override object CreateInstance(Type itemType)
{
return new GListViewFolder();
}
}
internal class GListViewItemConverter : ExpandableObjectConverter
{
public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
return true;
}
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
return new InstanceDescriptor(typeof( GListViewItem).GetConstructor(null),null,false);
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
internal class GListViewFolderConverter : ExpandableObjectConverter
{
public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
return true;
}
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
return new InstanceDescriptor(typeof( GListViewFolder).GetConstructor(null),null,false);
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?