public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings)
 {
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMaxWidth, (uint)200);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartType, (uint)VSSEARCHSTARTTYPE.SST_DELAYED);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartDelay, (uint)100);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchUseMRU, true);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.PrefixFilterMRUItems, false);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.MaximumMRUItems, (uint)25);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchWatermark, SearchWatermark);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchPopupAutoDropdown, false);
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlBorderThickness, "1");
     InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchProgressType, (uint)VSSEARCHPROGRESSTYPE.SPT_INDETERMINATE);
 }
        //https://msdn.microsoft.com/en-us/library/mt628927.aspx?f=255&MSPPError=-2147217396
        public Icon GetIcon(IClosedDocument document)
        {
            Icon icon = null;

            if (!string.IsNullOrWhiteSpace(document?.Name))
            {
                IVsUIObject uIObj = _vsImageService2.GetIconForFile(document.Name, __VSUIDATAFORMAT.VSDF_WINFORMS);
                if (uIObj != null)
                {
                    icon = (Icon)GelUtilities.GetObjectData(uIObj);
                }
            }

            return(icon);
        }
        /// <summary>
        /// Get the image based on the moniker, backColor and dimensions
        /// </summary>
        public static Bitmap GetImage(ImageMoniker moniker, System.Drawing.Color backColor, int height, int width, bool scalingRequired)
        {
            m_attributes.Background    = (uint)backColor.ToArgb();
            m_attributes.LogicalHeight = height;
            m_attributes.LogicalWidth  = width;

            if (scalingRequired)
            {
                m_attributes.LogicalHeight = (int)(height * DpiHelper.LogicalToDeviceUnitsScalingFactorY);
                m_attributes.LogicalWidth  = (int)(width * DpiHelper.LogicalToDeviceUnitsScalingFactorX);
            }

            IVsUIObject uIObjOK = ImageService.GetImage(moniker, m_attributes);
            Bitmap      bitmap  = (Bitmap)UIUtilities.GetObjectData(uIObjOK);

            bitmap.MakeTransparent(System.Drawing.Color.Magenta);

            return(bitmap);
        }
Exemple #4
0
        /// <summary>
        /// Load and display an image moniker in a PictureBox
        /// </summary>
        private void LoadMoniker(object sender, EventArgs e)
        {
            IVsImageService2 imageService = (IVsImageService2)OptionsPagePackageCS.GetGlobalService(typeof(SVsImageService));

            ImageAttributes attributes = new ImageAttributes
            {
                StructSize    = Marshal.SizeOf(typeof(ImageAttributes)),
                ImageType     = (uint)_UIImageType.IT_Bitmap,
                Format        = (uint)_UIDataFormat.DF_WinForms,
                LogicalWidth  = 32,
                LogicalHeight = 32,
                // Desired RGBA color, don't set IAF_Background below unless you also use this
                Background = 0xFFFFFFFF,
                // (uint)(_ImageAttributesFlags.IAF_RequiredFlags | _ImageAttributesFlags.IAF_Background)
                Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags,
            };

            IVsUIObject uIObj = imageService.GetImage(KnownMonikers.Search, attributes);

            bitmapPictureBox.Image = (Bitmap)GelUtilities.GetObjectData(uIObj);
        }
Exemple #5
0
        private Icon GetWarningIcon()
        {
            if (WarningIcon == null)
            {
                ImageAttributes attributes = new ImageAttributes
                {
                    StructSize    = Marshal.SizeOf(typeof(ImageAttributes)),
                    ImageType     = (uint)_UIImageType.IT_Icon,
                    Format        = (uint)_UIDataFormat.DF_WinForms,
                    LogicalWidth  = 16,
                    LogicalHeight = 16,
                    Flags         = (uint)_ImageAttributesFlags.IAF_RequiredFlags
                };

                IVsImageService2 imageService = (IVsImageService2)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsImageService));
                IVsUIObject      uIObj        = imageService.GetImage(KnownMonikers.StatusWarning, attributes);

                WarningIcon = (Icon)GelUtilities.GetObjectData(uIObj);
            }

            return(WarningIcon);
        }
Exemple #6
0
        //public IVsImageService2 ImageService { get; set; }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ImageMoniker imageMoniker = new ImageMoniker {
                Guid = JFrogManifestGuid, Id = 10
            };
            IVsImageService2 imageService = (IVsImageService2)Package.GetGlobalService(typeof(SVsImageService));
            ImageAttributes  attributes   = new ImageAttributes
            {
                StructSize = Marshal.SizeOf(typeof(ImageAttributes)),
                // IT_Bitmap for Bitmap, IT_Icon for Icon
                ImageType     = (uint)_UIImageType.IT_Bitmap,
                Format        = (uint)_UIDataFormat.DF_WinForms,
                LogicalWidth  = 16,
                LogicalHeight = 16,
                // Desired RGBA color, if you don't use this, don't set IAF_Background below
                Background = 0xFFFFFFFF,
                Flags      = (uint)_ImageAttributesFlags.IAF_RequiredFlags,
            };
            IVsUIObject uIObj = imageService.GetImage(imageMoniker, attributes);

            return((BitmapImage)GelUtilities.GetObjectData(uIObj));
//            return new ImageMoniker { Guid = JFrogManifestGuid, Id = 20 };
        }