コード例 #1
0
        public void PopulateAvailableColumns(Collumns[] AvailableCols, ExplorerBrowser ShellView, System.Windows.Point Location)
        {

            BrowserControl = ShellView;
            for (int i = 1; i < AvailableCols.Length; i++)
            {
                if (AvailableCols[i].Name == null)
                {
                    MessageBox.Show("The More Columns dialog cannot be shown right now.", "More Columns", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                ListViewItem lvi = new ListViewItem(AvailableCols[i].Name);
                lvi.Tag = AvailableCols[i].pkey;
                foreach (Collumns collumn in ShellView.AvailableVisibleColumns)
	            {
		            if (collumn.pkey.fmtid == AvailableCols[i].pkey.fmtid && collumn.pkey.pid == AvailableCols[i].pkey.pid)
	                {
                        lvi.Checked = true;
	                }
	            }
                
                lvColumns.Items.Add(lvi);
            }
            Opacity = 0;
            Show();
            this.Location = new Point((int)Location.X, (int)Location.Y);
            //this.lvColumns.Sort(); //'this didn't do anything... lol.
            this.lvColumns.Sorting = SortOrder.Ascending;
            Opacity = 255;
        }
コード例 #2
0
        public Collumns[] AvailableColumns(IShellView SHView, bool All)
        {

            Guid iid = new Guid(ExplorerBrowserIIDGuid.IColumnManager);
            IntPtr view = IntPtr.Zero;
            IntPtr Ishellv = IntPtr.Zero;
            Ishellv = Marshal.GetComInterfaceForObject(GetShellView(), typeof(IShellView));
            Marshal.QueryInterface(Ishellv, ref iid, out view);
            IColumnManager cm = (IColumnManager)Marshal.GetObjectForIUnknown(view);
            uint HeaderColsCount = 0;
            cm.GetColumnCount(All?CM_ENUM_FLAGS.CM_ENUM_ALL:CM_ENUM_FLAGS.CM_ENUM_VISIBLE, out HeaderColsCount);
            Collumns[] ci = new Collumns[HeaderColsCount];
            for (int i = 0; i < HeaderColsCount; i++)
            {
                Collumns col = new Collumns();
                PROPERTYKEY pk;
                CM_COLUMNINFO cmi;

                try
                {
                    GetColumnbyIndex(GetShellView(), All, i, out pk);
                    GetColumnInfobyIndex(GetShellView(), All, i, out cmi);
                    col.pkey = pk;
                    col.Name = cmi.wszName;
                    col.Width = (int)cmi.uWidth;
                    ci[i] = col;

                }
                catch 
                {


                }

            }


            return ci;
        }