コード例 #1
0
        private List <Color> GetVisualStudioBasicColorList()
        {
            IVsUIShell uiShell = (IVsUIShell)ChangesetViewerPackage.GetGlobalService(typeof(IVsUIShell));

            List <Color> result = new List <Color>();

            foreach (VSSYSCOLOR vsSysColor in Enum.GetValues(typeof(VSSYSCOLOR)))
            {
                uint win32Color;
                uiShell.GetVSSysColor(vsSysColor, out win32Color);
                Color color = ColorTranslator.FromWin32((int)win32Color);
                result.Add(color);
            }

            return(result);
        }
コード例 #2
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");
                }
            }