Exemplo n.º 1
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);
        }
 public void OptionsPagePackageConstructorTest()
 {
     OptionsPagePackageCS target = new OptionsPagePackageCS();
     Assert.IsNotNull(target, "Instance of the OptionsPagePackage object was not created successfully.");
 }
        public void OptionsPagePackageTestInitialize()
        {
            testPackage = new OptionsPagePackageCS();

            // Create a basic service provider
            serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();
            AddBasicSiteSupport(serviceProvider);

            ((IVsPackage)testPackage).SetSite(serviceProvider);
        }
 /// <summary> 
 /// Clean up any resources being used.
 /// </summary>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (testPackage != null)
         {
             testPackage = null;
         }
         if( serviceProvider != null )
         {
             serviceProvider = null;
         }
         GC.SuppressFinalize(this);
     }
 }
 public void OptionsPagePackageTestCleanup()
 {
     testPackage = null;
     serviceProvider = null;
     Dispose();
 }