예제 #1
0
        public LocalTreeView()
        {
            InitializeComponent();

            int styleFlags = NativeMethods.TVS_EX_FADEINOUTEXPANDOS | NativeMethods.TVS_EX_DOUBLEBUFFER;

            NativeMethods.SendMessage(treeView.Handle, NativeMethods.TVM_SETEXTENDEDSTYLE, styleFlags, styleFlags);

            NativeMethods.SetWindowTheme(treeView.Handle, "Explorer", null);

            if (DpiHelper.IsScalingRequired)
            {
                imageListOverlays.ImageSize = DpiHelper.LogicalToDeviceUnits(imageListOverlays.ImageSize);
                imageListOverlays.Images.AddStrip(DpiHelper.ScaleBitmapLogicalToDevice(TFV.Properties.Resources.TreeViewStateIcons));
            }
            else
            {
                imageListOverlays.Images.AddStrip(TFV.Properties.Resources.TreeViewStateIcons);
            }

            ImageList temp = new ImageList();

            temp.ImageSize     = DpiHelper.LogicalToDeviceUnits(new Size(16, 16));
            temp.ColorDepth    = ColorDepth.Depth32Bit;
            treeView.ImageList = temp;

            m_fileIcon      = NativeMethods.GetSmallIcon(NativeMethods.SHSTOCKICONID.SIID_DOCNOASSOC);
            m_addedFileIcon = NativeMethods.GetSmallIcon(NativeMethods.SHSTOCKICONID.SIID_DOCASSOC);
            m_folderOpen    = NativeMethods.GetSmallIcon(NativeMethods.SHSTOCKICONID.SIID_FOLDEROPEN);
            m_folderClosed  = NativeMethods.GetSmallIcon(NativeMethods.SHSTOCKICONID.SIID_FOLDERBACK);
        }
예제 #2
0
        public ServerTreeView()
        {
            InitializeComponent();

            int styleFlags = NativeMethods.TVS_EX_FADEINOUTEXPANDOS | NativeMethods.TVS_EX_DOUBLEBUFFER;

            NativeMethods.SendMessage(treeView.Handle, NativeMethods.TVM_SETEXTENDEDSTYLE, styleFlags, styleFlags);

            NativeMethods.SetWindowTheme(treeView.Handle, "Explorer", null);

            if (DpiHelper.IsScalingRequired)
            {
                imageListIcons.ImageSize    = DpiHelper.LogicalToDeviceUnits(imageListIcons.ImageSize);
                imageListOverlays.ImageSize = DpiHelper.LogicalToDeviceUnits(imageListOverlays.ImageSize);
                imageListIcons.Images.AddStrip(DpiHelper.ScaleBitmapLogicalToDevice(TFV.Properties.Resources.TreeViewIcons));
                imageListOverlays.Images.AddStrip(DpiHelper.ScaleBitmapLogicalToDevice(TFV.Properties.Resources.TreeViewStateIcons));
            }
            else
            {
                imageListIcons.Images.AddStrip(TFV.Properties.Resources.TreeViewIcons);
                imageListOverlays.Images.AddStrip(TFV.Properties.Resources.TreeViewStateIcons);
            }

            ImageList temp = new ImageList();

            temp.ImageSize     = imageListIcons.ImageSize;
            temp.ColorDepth    = ColorDepth.Depth32Bit;
            treeView.ImageList = temp;
        }