Exemple #1
0
        public ExpTree()
        {
            //This call is required by the Windows Form Designer.
            InitializeComponent();

            //Add any initialization after the InitializeComponent() call


            //setting the imagelist here allows many good things to happen, but
            // also one bad thing -- the "tooltip" like display of selectednode.text
            // is made invisible.  This remains a problem to be solved.
            SystemImageListManager.SetTreeViewImageList(tv1, false);

            StartUpDirectoryChanged += new ExpTreeLib.ExpTree.StartUpDirectoryChangedEventHandler(OnStartUpDirectoryChanged);

            OnStartUpDirectoryChanged(m_StartUpDirectory);

            if (tv1.IsHandleCreated)
            {
                if (this.AllowDrop)
                {
                    if (Application.OleRequired() == System.Threading.ApartmentState.STA)
                    {
                        DragDropHandler              = new TVDragWrapper(tv1);
                        DragDropHandler.ShDragEnter += new ExpTreeLib.TVDragWrapper.ShDragEnterEventHandler(DragWrapper_ShDragEnter);
                        DragDropHandler.ShDragLeave += new ExpTreeLib.TVDragWrapper.ShDragLeaveEventHandler(DragWrapper_ShDragLeave);
                        DragDropHandler.ShDragOver  += new ExpTreeLib.TVDragWrapper.ShDragOverEventHandler(DragWrapper_ShDragOver);
                        DragDropHandler.ShDragDrop  += new ExpTreeLib.TVDragWrapper.ShDragDropEventHandler(DragWrapper_ShDragDrop);
                        int res;
                        res = ShellDll.RegisterDragDrop(tv1.Handle, DragDropHandler);
                        if (!(res == 0) || (res == -2147221247))
                        {
                            Marshal.ThrowExceptionForHR(res);
                            throw (new Exception("Failed to Register DragDrop for " + this.Name));
                        }
                    }
                    else
                    {
                        throw (new ThreadStateException("ThreadMustBeSTA"));
                    }
                }
            }
        }
Exemple #2
0
        public ExpTree()
        {
            //This call is required by the Windows Form Designer.
            InitializeComponent();

            //Add any initialization after the InitializeComponent() call

            //setting the imagelist here allows many good things to happen, but
            // also one bad thing -- the "tooltip" like display of selectednode.text
            // is made invisible.  This remains a problem to be solved.
            SystemImageListManager.SetTreeViewImageList(tv1, false);

            StartUpDirectoryChanged += new ExpTreeLib.ExpTree.StartUpDirectoryChangedEventHandler(OnStartUpDirectoryChanged);

            OnStartUpDirectoryChanged(m_StartUpDirectory);

            if (tv1.IsHandleCreated)
            {
                if (this.AllowDrop)
                {
                    if (Application.OleRequired() == System.Threading.ApartmentState.STA)
                    {
                        DragDropHandler = new TVDragWrapper(tv1);
                        DragDropHandler.ShDragEnter += new ExpTreeLib.TVDragWrapper.ShDragEnterEventHandler(DragWrapper_ShDragEnter);
                        DragDropHandler.ShDragLeave += new ExpTreeLib.TVDragWrapper.ShDragLeaveEventHandler(DragWrapper_ShDragLeave);
                        DragDropHandler.ShDragOver += new ExpTreeLib.TVDragWrapper.ShDragOverEventHandler(DragWrapper_ShDragOver);
                        DragDropHandler.ShDragDrop += new ExpTreeLib.TVDragWrapper.ShDragDropEventHandler(DragWrapper_ShDragDrop);
                        int res;
                        res = ShellDll.RegisterDragDrop(tv1.Handle, DragDropHandler);
                        if (!(res == 0) || (res == - 2147221247))
                        {
                            Marshal.ThrowExceptionForHR(res);
                            throw (new Exception("Failed to Register DragDrop for " + this.Name));
                        }
                    }
                    else
                    {
                        throw (new ThreadStateException("ThreadMustBeSTA"));
                    }
                }
            }
        }