标签:design attribute pac OLE 复杂 编辑器 name sha lin
出处:http://www.newlifex.com/showtopic-167.aspx
using System;
using System.Collections;
using System.ComponentModel;
using System.Reflection;
namespace HmFramework.UI.Sprite.Services
{
internal class EventBindingServiceExt : System.ComponentModel.Design.EventBindingService
{
public EventBindingServiceExt(IServiceProvider provider)
: base(provider)
{
}
protected override String CreateUniqueMethodName(IComponent component, EventDescriptor e)
{
return String.Format("{0}_{1}", Char.ToUpper(component.Site.Name[0]) + component.Site.Name.Substring(1), e.DisplayName);
}
// sohuld look around in form class for compatiable methodes
protected override ICollection GetCompatibleMethods(EventDescriptor e)
{
ArrayList al = new ArrayList();
MethodInfo methodInfo = e.EventType.GetMethod("Invoke");
if (null != methodInfo)
{
al.Add(methodInfo.Name);
}
return al;
}
protected override Boolean ShowCode()
{
//IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
//if (window == null) {
// return false;
//}
//FormsDesignerViewContent formDesigner = window.ActiveViewContent as FormsDesignerViewContent;
//if (formDesigner != null) {
// formDesigner.ShowSourceCode();
// return true;
//}
return false;
}
protected override Boolean ShowCode(Int32 lineNumber)
{
//IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
//if (window == null) {
// return false;
//}
//FormsDesignerViewContent formDesigner = window.ActiveViewContent as FormsDesignerViewContent;
//if (formDesigner != null) {
// formDesigner.ShowSourceCode(lineNumber);
// return true;
//}
return false;
}
protected override Boolean ShowCode(IComponent component, EventDescriptor edesc, String methodName)
{
//System.Windows.Forms.MessageBox.Show("to add:" + component.Site.Name + "\r\n" + methodName);
return false;
}
}
}
标签:design attribute pac OLE 复杂 编辑器 name sha lin
原文地址:https://www.cnblogs.com/smileberry/p/9122299.html