Beispiel #1
0
        public void AddItem(String strGroupName, String strItemName, Type type)
        {
            TypeResolutionService.AddType(type);

            if (DefaultIcon == null)
            {
                DefaultIcon = GetIcon(typeof(ABCControls.ABCGroupControl), false);
            }

            DevExpress.XtraNavBar.NavBarItem item = new DevExpress.XtraNavBar.NavBarItem();
            item.Caption = strItemName;
            item.Name    = strItemName;

            ABCToolboxItem toolboxItem = new ABCToolboxItem(type);

            toolboxItem.Binding           = new ABCControls.ABCBindingInfo();
            toolboxItem.Binding.FieldName = strItemName;
            item.Tag = toolboxItem;

            Bitmap icon = GetIcon(type, false);

            if (ImageCompareString(icon, DefaultIcon))
            {
                icon = GetIcon(type, true);
            }

            //    icon.Save( String.Format(@"Icons\{0}.png" , strItemName ));
            item.SmallImage = icon;
            this.navBarControl.Items.Add(item);
            this.navBarControl.Groups[strGroupName].ItemLinks.Add(item);

            HostSurfaceManager.CreateTemplateComponent(type);
        }
Beispiel #2
0
        void ViewTree_DragOver(object sender, DragEventArgs e)
        {
            if (e.Data is DataObject)
            {
                DataObject data = (DataObject)e.Data;
                DevExpress.XtraTreeList.Nodes.TreeListNode objNode = (DevExpress.XtraTreeList.Nodes.TreeListNode)data.GetData(typeof(DevExpress.XtraTreeList.Nodes.TreeListNode));
                if (objNode != null)
                {
                    MyData obj = (MyData)this.GetDataRecordByNode(objNode);
                    if (obj == null || obj.InnerData == null)
                    {
                        return;
                    }

                    STViewsInfo    info        = (STViewsInfo)obj.InnerData;
                    ABCToolboxItem toolboxItem = new ABCToolboxItem(typeof(ABCControls.ABCView));
                    toolboxItem.Binding          = new ABCControls.ABCBindingInfo();
                    toolboxItem.Binding.ViewInfo = info;

                    data = OwnerStudio.Toolbox.SerializeToolboxItem(toolboxItem) as DataObject;
                    try
                    {
                        OwnerStudio.Toolbox.DoDragDrop(data, DragDropEffects.Copy);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }