コード例 #1
0
        public override void LoadPanelContents()
        {
            SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GeneralTextEditorPanel.xfrm"));

            fontListComboBox = ((ComboBox)ControlDictionary["fontListComboBox"]);
            fontSizeComboBox = ((ComboBox)ControlDictionary["fontSizeComboBox"]);

            ((CheckBox)ControlDictionary["enableDoublebufferingCheckBox"]).Checked = ((Properties)CustomizationObject).Get("DoubleBuffer", true);
            //((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked  = ((Properties)CustomizationObject).Get("EnableCodeCompletion", true);
            ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked         = ((Properties)CustomizationObject).Get("EnableFolding", true);
            ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked = ((Properties)CustomizationObject).Get("ShowQuickClassBrowserPanel", true);

            ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = ((Properties)CustomizationObject).Get("UseAntiAliasFont", false);
            ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked        = ((Properties)CustomizationObject).Get("MouseWheelTextZoom", true);

            foreach (String name in CharacterEncodings.Names)
            {
                ((ComboBox)ControlDictionary["textEncodingComboBox"]).Items.Add(name);
            }
            int encodingIndex = 0;

            try {
                encodingIndex = CharacterEncodings.GetEncodingIndex((Int32)((Properties)CustomizationObject).Get("Encoding", encoding));
            } catch {
                encodingIndex = CharacterEncodings.GetEncodingIndex(encoding);
            }
            ((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex;
            encoding = CharacterEncodings.GetEncodingByIndex(encodingIndex).CodePage;

            for (int i = 6; i <= 24; ++i)
            {
                fontSizeComboBox.Items.Add(i);
            }

            fontSizeComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel);
            fontSizeComboBox.Enabled      = false;

            fontListComboBox.Enabled               = false;
            fontListComboBox.TextChanged          += new EventHandler(UpdateFontPreviewLabel);
            fontListComboBox.SelectedIndexChanged += new EventHandler(UpdateFontPreviewLabel);

            Font currentFont = FontSelectionPanel.ParseFont(((Properties)CustomizationObject).Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString());

            helper = new FontSelectionPanelHelper(fontSizeComboBox, fontListComboBox, currentFont);

            fontListComboBox.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(helper.MeasureComboBoxItem);
            fontListComboBox.DrawItem    += new System.Windows.Forms.DrawItemEventHandler(helper.ComboBoxDrawItem);

            UpdateFontPreviewLabel(null, null);
            helper.StartThread();
        }
コード例 #2
0
        public override void LoadPanelContents()
        {
            SetupFromXmlFile(Path.Combine(PropertyService.DataDirectory, @"resources\panels\GeneralTextEditorPanel.xfrm"));

            ((CheckBox)ControlDictionary["enableDoublebufferingCheckBox"]).Checked = ((IProperties)CustomizationObject).GetProperty("DoubleBuffer", true);
            ((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked  = ((IProperties)CustomizationObject).GetProperty("EnableCodeCompletion", true);
            ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked         = ((IProperties)CustomizationObject).GetProperty("EnableFolding", true);
            ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked = ((IProperties)CustomizationObject).GetProperty("ShowQuickClassBrowserPanel", true);

            ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = ((IProperties)CustomizationObject).GetProperty("UseAntiAliasFont", false);
            ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked        = ((IProperties)CustomizationObject).GetProperty("MouseWheelTextZoom", true);

            foreach (String name in CharacterEncodings.Names)
            {
                ((ComboBox)ControlDictionary["textEncodingComboBox"]).Items.Add(name);
            }
            int encodingIndex = 0;

            try
            {
                encodingIndex = CharacterEncodings.GetEncodingIndex((Int32)((IProperties)CustomizationObject).GetProperty("Encoding", encoding));
            }
            catch
            {
                encodingIndex = CharacterEncodings.GetEncodingIndex(encoding);
            }
            ((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex;
            encoding = CharacterEncodings.GetEncodingByIndex(encodingIndex).CodePage;

            Font currentFont = ParseFont(((IProperties)CustomizationObject).GetProperty("DefaultFont", new Font("Courier New", 10)).ToString());

            for (int i = 6; i <= 24; ++i)
            {
                ((ComboBox)ControlDictionary["fontSizeComboBox"]).Items.Add(i);
            }
            ((ComboBox)ControlDictionary["fontSizeComboBox"]).Text         = currentFont.Size.ToString();
            ((ComboBox)ControlDictionary["fontSizeComboBox"]).TextChanged += new EventHandler(UpdateFontPreviewLabel);

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            int index = 0;

            foreach (FontFamily fontFamily in installedFontCollection.Families)
            {
                if (fontFamily.IsStyleAvailable(FontStyle.Regular) && fontFamily.IsStyleAvailable(FontStyle.Bold) && fontFamily.IsStyleAvailable(FontStyle.Italic))
                {
                    if (fontFamily.Name == currentFont.Name)
                    {
                        index = ((ComboBox)ControlDictionary["fontListComboBox"]).Items.Count;
                    }
                    ((ComboBox)ControlDictionary["fontListComboBox"]).Items.Add(new FontDescriptor(fontFamily.Name, IsMonospaced(fontFamily)));
                }
            }

            ((ComboBox)ControlDictionary["fontListComboBox"]).SelectedIndex         = index;
            ((ComboBox)ControlDictionary["fontListComboBox"]).TextChanged          += new EventHandler(UpdateFontPreviewLabel);
            ((ComboBox)ControlDictionary["fontListComboBox"]).SelectedIndexChanged += new EventHandler(UpdateFontPreviewLabel);
            ((ComboBox)ControlDictionary["fontListComboBox"]).MeasureItem          += new System.Windows.Forms.MeasureItemEventHandler(this.MeasureComboBoxItem);
            ((ComboBox)ControlDictionary["fontListComboBox"]).DrawItem             += new System.Windows.Forms.DrawItemEventHandler(this.ComboBoxDrawItem);

            boldComboBoxFont = new Font(ControlDictionary["fontListComboBox"].Font, FontStyle.Bold);

            UpdateFontPreviewLabel(this, EventArgs.Empty);
        }