Source/ContextExMenuTypeEditor.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.Drawing.Design;
namespace DevComponents.DotNetBar
{
/// <summary>
/// Summary description for ContextExMenuTypeEditor.
/// </summary>
public class ContextExMenuTypeEditor : System.Drawing.Design.UITypeEditor
{
private IWindowsFormsEditorService edSvc = null;
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
edSvc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
ContextMenuBar cb = null;
GridItem pg = provider as GridItem;
string propLabel = "";
if (pg != null)
propLabel = pg.Label;
foreach (IComponent c in context.Container.Components)
{
if (c is ContextMenuBar)
{
if(propLabel.EndsWith(((ContextMenuBar)c).Name) || propLabel=="")
{
cb = c as ContextMenuBar;
break;
}
}
}
BaseItem selectedItem=null;
if(value!=null && value is BaseItem)
selectedItem = (BaseItem)value;
if(cb!=null && edSvc!=null)
{
ListBox lb=new ListBox();
lb.SelectedIndexChanged+=new EventHandler(this.SelectedChanged);
foreach(BaseItem item in cb.Items)
{
if(item.Name!="")
{
int i=lb.Items.Add(item.Name);
if (item == selectedItem)
lb.SelectedIndex=i;
}
}
edSvc.DropDownControl(lb);
if(lb.SelectedItem!=null)
后面还有 29 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。