예제 #1
0
            public override object this[object key] {
                get {
                    if (key is string)
                    {
                        string strKey = (string)key;
                        if (strKey.Equals("HighlightColor"))
                        {
                            if (shellLightColor == SystemColors.Info)
                            {
                                IVsUIShell vsUIShell = (IVsUIShell)owner.GetService(typeof(IVsUIShell));
                                if (vsUIShell != null)
                                {
                                    int vscolor = vsUIShell.GetVSSysColor(__VSSYSCOLOR.VSCOLOR_LIGHT);
                                    shellLightColor = ColorTranslator.FromWin32(vscolor);
                                }
                                else
                                {
                                    shellLightColor = SystemColors.Info;
                                }
                            }
                            return(shellLightColor);
                        }
                        else if (strKey.Equals("DialogFont"))
                        {
                            Font shellFont;
                            // Get the default font from the shell.
                            IUIHostLocale locale = (IUIHostLocale)owner.GetService(typeof(IUIHostLocale));
                            if (locale == null)
                            {
                                shellFont = Control.DefaultFont;
                            }
                            else
                            {
                                shellFont = DesignerPackage.GetFontFromShell(locale);
                            }
                            return(shellFont);
                        }
                    }

                    throw new NotImplementedException("Does not support this key: " + key.ToString());
                }

                set {
                    throw new NotImplementedException("This collection does not support adding values");
                }
            }
예제 #2
0
 public VSStyles(DesignerPackage owner)
 {
     Debug.Assert(owner != null, "No service provider to get to the shell's styles");
     this.owner = owner;
 }