Esempio n. 1
0
        public ImageList(Int32 size)
        {
            var CLSID_ImageList = Guid.Parse("7C476BA2-02B1-48f4-8048-B24619DDC058");
            var refIImageList2  = typeof(IImageList).GUID;
            var IID_IUnknown    = new Guid("00000000-0000-0000-C000-000000000046");
            var ptr             = IntPtr.Zero;

            //var result = Ole32.CoCreateInstance(ref CLSID_ImageList, IntPtr.Zero, Ole32.CLSCTX.INPROC_SERVER, ref IID_IUnknown, out ptr);
            ptr             = ComCtl32.ImageList_Create(size, size, 0x00000020 | 0x00010000 | 0x00020000, 0, 1);
            this._ImageList = (IImageList2)Marshal.GetObjectForIUnknown(ptr);
            this.Handle     = ptr;
        }
Esempio n. 2
0
        public ImageListEx(Int32 size)
        {
            var ptr = IntPtr.Zero;

            this._CurrentSize = size;
            ptr = ComCtl32.ImageList_Create(size, size, 0x00000020 | 0x00010000 | 0x00020000, 0, 1);
            this._IImageList        = (IImageList2)Marshal.GetObjectForIUnknown(ptr);
            this.Handle             = ptr;
            this._IconLoadingThread = new Thread(_IconsLoadingThreadRun)
            {
                IsBackground = true, Priority = ThreadPriority.Normal
            };
            this._IconLoadingThread.IsBackground = true;
            this._IconLoadingThread.SetApartmentState(ApartmentState.STA);
            this._IconLoadingThread.Start();
            this._IconCacheLoadingThread = new Thread(_IconCacheLoadingThreadRun)
            {
                IsBackground = true, Priority = ThreadPriority.BelowNormal
            };
            this._IconCacheLoadingThread.SetApartmentState(ApartmentState.STA);
            this._IconCacheLoadingThread.IsBackground = true;
            this._IconCacheLoadingThread.Start();
            this._OverlaysLoadingThread = new Thread(_OverlaysLoadingThreadRun)
            {
                IsBackground = true, Priority = ThreadPriority.BelowNormal
            };
            this._OverlaysLoadingThread.SetApartmentState(ApartmentState.STA);
            this._OverlaysLoadingThread.IsBackground = true;
            this._OverlaysLoadingThread.Start();
            this._UpdateSubitemValuesThread = new Thread(_UpdateSubitemValuesThreadRun)
            {
                Priority = ThreadPriority.BelowNormal
            };
            this._UpdateSubitemValuesThread.SetApartmentState(ApartmentState.STA);
            this._UpdateSubitemValuesThread.IsBackground = true;
            this._UpdateSubitemValuesThread.Start();
            this._RedrawingThread = new Thread(_RedrawingThreadRun)
            {
                IsBackground = true, Priority = ThreadPriority.Normal
            };
            this._RedrawingThread.SetApartmentState(ApartmentState.STA);
            this._RedrawingThread.IsBackground = true;
            this._RedrawingThread.Start();
            var defIconInfo = new Shell32.SHSTOCKICONINFO()
            {
                cbSize = (UInt32)Marshal.SizeOf(typeof(Shell32.SHSTOCKICONINFO))
            };

            Shell32.SHGetStockIconInfo(Shell32.SHSTOCKICONID.SIID_APPLICATION, Shell32.SHGSI.SHGSI_SYSICONINDEX, ref defIconInfo);
            this._ExeFallBackIndex = defIconInfo.iSysIconIndex;
            Shell32.SHGetStockIconInfo(Shell32.SHSTOCKICONID.SIID_SHIELD, Shell32.SHGSI.SHGSI_SYSICONINDEX, ref defIconInfo);
            this._ShieldIconIndex = defIconInfo.iSysIconIndex;

            Shell32.SHGetStockIconInfo(Shell32.SHSTOCKICONID.SIID_SHARE, Shell32.SHGSI.SHGSI_SYSICONINDEX, ref defIconInfo);
            this._SharedIconIndex = defIconInfo.iSysIconIndex;

            Shell32.SHGetStockIconInfo(Shell32.SHSTOCKICONID.SIID_FOLDER, Shell32.SHGSI.SHGSI_SYSICONINDEX, ref defIconInfo);
            this._FolderFallBackIndex = defIconInfo.iSysIconIndex;

            Shell32.SHGetStockIconInfo(Shell32.SHSTOCKICONID.SIID_DOCNOASSOC, Shell32.SHGSI.SHGSI_SYSICONINDEX, ref defIconInfo);
            this._DefaultFallBackIndex = defIconInfo.iSysIconIndex;
            var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            this._VideAddornerWide = FileSystemListItem.ToFileSystemItem(IntPtr.Zero, Path.Combine(basePath, "video_addorner_wide.png"));
            this._VideAddorner     = FileSystemListItem.ToFileSystemItem(IntPtr.Zero, Path.Combine(basePath, "video_addorner.png"));
        }