2 renzhansheng55 renzhansheng55 于 2015.06.21 11:11 提问

C# 呈现控件时出错 非可视控件,不支持设置visible属性 10C

图片说明
我要写一个数据源控件acDataSource,是不可视控件,并添加智能标记。
在使用该控件的时候,发生了上面的错误。
下面是智能标记的代码,大神帮帮忙看看是什么问题。
同样的代码用在可视控件上没有问题,因为是从MSDN上Copy下来的

 class AcDataSourceDesigner : ControlDesigner
    {
        private DesignerActionListCollection actionLists;

        public override DesignerActionListCollection ActionLists
        {
            get
            {
                if (null == actionLists)
                {
                    actionLists = new DesignerActionListCollection();
                    actionLists.Add(new AcDataSourceActionList(this.Component));
                }
                return actionLists;
            }
        }
    }
    public class AcDataSourceActionList : DesignerActionList
    {
        private AcDataSource parent;

        public AcDataSourceActionList(IComponent component)
            : base(component)
        {
            this.parent = component as AcDataSource;
        }

        public override DesignerActionItemCollection GetSortedActionItems()
        {
            DesignerActionItemCollection items = new DesignerActionItemCollection();
            items.Add(new DesignerActionMethodItem(this, "ConfigureDataSource", "配置数据源...", "Appearance", "配置数据源的设置."));
            return items;
        }

        public void ConfigureDataSource()
        {
            Form frm = new Form();
            frm.Show();
        }

    }
Csdn user default icon
上传中...
上传图片
插入图片