当前位置: 首页>>代码示例>>C#>>正文


C# Text.InstalledFontCollection类代码示例

本文整理汇总了C#中System.Drawing.Text.InstalledFontCollection的典型用法代码示例。如果您正苦于以下问题:C# InstalledFontCollection类的具体用法?C# InstalledFontCollection怎么用?C# InstalledFontCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InstalledFontCollection类属于System.Drawing.Text命名空间,在下文中一共展示了InstalledFontCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            // renk
            string[] colorArray = Enum.GetNames(typeof(System.Drawing.KnownColor));
            lstBackColor.DataSource = colorArray;
            lstBackColor.DataBind();

            // font
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily family in fonts.Families)
            {
                lstFontName.Items.Add(family.Name);
            }

            ListItem item = new ListItem();
            string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));
            lstBorder.DataSource = borderStyleArray;
            lstBorder.DataBind();

            lstBorder.SelectedIndex = 0;

            imgDefault.ImageUrl = "images/default-user-image.png";
            imgDefault.Visible = false;
        }
    }
开发者ID:madmed,项目名称:netron,代码行数:27,代码来源:Default.aspx.cs

示例2: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            ddlTextMode.DataSource = Enum.GetValues(typeof(Models.TextMode));
            ddlTextMode.DataBind();

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();
            ddlFontFamily.DataSource = installedFontCollection.Families.Select(x => x.Name);
            ddlFontFamily.DataBind();

            if (PrevalueEditor.Configuration == null)
            {
                ddlTextMode.SelectedValue = Models.TextMode.SingleLine.ToString();
                ddlFontFamily.SelectedValue = "Arial";
            }
            else
            {
                ddlTextMode.SelectedValue = PrevalueEditor.Configuration.TextMode.ToString();
                ddlFontFamily.SelectedValue = PrevalueEditor.Configuration.FontFamily;
                tbFontSize.Text = PrevalueEditor.Configuration.FontSize.ToString();
                tbLineHeight.Text = PrevalueEditor.Configuration.LineHeight.ToString();
                rblFontWeight.SelectedValue = PrevalueEditor.Configuration.FontWeight.ToString();
                tbBoxWidth.Text = PrevalueEditor.Configuration.BoxWidth.ToString();
                tbBoxHeight.Text = PrevalueEditor.Configuration.BoxHeight.ToString();
            }
        }
开发者ID:kipusoep,项目名称:TextFieldPreviewable,代码行数:27,代码来源:PrevalueEditorControl.ascx.cs

示例3: AutoSearchOptions

		public AutoSearchOptions()
		{
			InitializeComponent();

			if (!String.IsNullOrEmpty(Properties.Settings.Default.LastSearchFolderUsed))
				textBoxSearchStart.Text = Properties.Settings.Default.LastSearchFolderUsed;
			else
				textBoxSearchStart.Text = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

			textBoxStoreResults.Text =
#if DEBUG
				@"C:\Trashbin";
#else
				@"C:\Backup";
#endif
			textBoxSearchFilter.Text = cstrDefaultFilter;
			RegistryKey keyDocx = Registry.ClassesRoot.OpenSubKey(cstrDocxExtension, false);
			if (keyDocx != null)
				textBoxSearchFilter.Text += ';' + cstrFilterAdd2007;
			else
				m_bNeed2007 = true; // this indicates that 2007 isn't installed, so if the user adds the .docx, we tell her it's needed.

			InstalledFontCollection installedFontCollection = new InstalledFontCollection();

			// Get the array of FontFamily objects.
			ColumnFont.Items.Add(""); // make the first one null, so users can cancel one (I can't figure out how to actually delete the row)
			foreach (FontFamily ff in installedFontCollection.Families)
				ColumnFont.Items.Add(ff.Name);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:AutoSearchOptions.cs

示例4: FormSheetFieldStatic_Load

		private void FormSheetFieldStatic_Load(object sender,EventArgs e) {
			if(IsReadOnly){
				butOK.Enabled=false;
				butDelete.Enabled=false;
			}
			if(SheetDefCur.SheetType==SheetTypeEnum.PatientLetter) {
				butExamSheet.Visible=true;
			}
			else {
				butExamSheet.Visible=false;
			}
			textFieldValue.Text=SheetFieldDefCur.FieldValue;
			InstalledFontCollection fColl=new InstalledFontCollection();
			for(int i=0;i<fColl.Families.Length;i++){
				comboFontName.Items.Add(fColl.Families[i].Name);
			}
			comboFontName.Text=SheetFieldDefCur.FontName;
			textFontSize.Text=SheetFieldDefCur.FontSize.ToString();
			checkFontIsBold.Checked=SheetFieldDefCur.FontIsBold;
			for(int i=0;i<Enum.GetNames(typeof(GrowthBehaviorEnum)).Length;i++){
				comboGrowthBehavior.Items.Add(Enum.GetNames(typeof(GrowthBehaviorEnum))[i]);
				if((int)SheetFieldDefCur.GrowthBehavior==i){
					comboGrowthBehavior.SelectedIndex=i;
				}
			}
			textXPos.Text=SheetFieldDefCur.XPos.ToString();
			textYPos.Text=SheetFieldDefCur.YPos.ToString();
			textWidth.Text=SheetFieldDefCur.Width.ToString();
			textHeight.Text=SheetFieldDefCur.Height.ToString();
			FillFields();
		}
开发者ID:romeroyonatan,项目名称:opendental,代码行数:31,代码来源:FormSheetFieldStatic.cs

示例5: b_DisplayFonts_Click

        private void b_DisplayFonts_Click(object sender, EventArgs e)
        {
            InstalledFontCollection ifc = new InstalledFontCollection();
            FontFamily[] ffs = ifc.Families;
            Font f;
            richTextBox1.Clear();
            foreach (FontFamily ff in ffs)
            {
                // 设置待写入文字的字体
                if (ff.IsStyleAvailable(System.Drawing.FontStyle.Regular))
                    f = new Font(ff.GetName(1), 12, System.Drawing.FontStyle.Regular);

                else if (ff.IsStyleAvailable(System.Drawing.FontStyle.Bold))

                    f = new Font(ff.GetName(1), 12, System.Drawing.FontStyle.Bold);
                else if (ff.IsStyleAvailable(System.Drawing.FontStyle.Italic))
                    f = new Font(ff.GetName(1), 12, System.Drawing.FontStyle.Italic);
                else
                    f = new Font(ff.GetName(1), 12, System.Drawing.FontStyle.Underline);

                // 注意:每次AppendText之前都设置字体
                richTextBox1.SelectionFont = f;
                richTextBox1.AppendText(ff.GetName(1) + "\r\n");
                richTextBox1.SelectionFont = f;
                richTextBox1.AppendText("abcdefghijklmnopqrstuvwxyz\r\n");
                richTextBox1.SelectionFont = f;
                richTextBox1.AppendText("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");

                richTextBox1.AppendText("===================================================\r\n");

            }

            MessageBox.Show("已把所有字体显示在文本框中", "成功", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
开发者ID:ShiJess,项目名称:CompanyStudy,代码行数:34,代码来源:displayFont.cs

示例6: DefaultFontsControl

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="DefaultFontsControl"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public DefaultFontsControl()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// Fill in the font selection combo boxes.

			using (var installedFontCollection = new InstalledFontCollection())
			{
				// Mono doesn't sort the font names currently 20100322. Workaround for FWNX-273: Fonts not in alphabetical order
				IEnumerable<FontFamily> fontFamilies = from family in installedFontCollection.Families
													   orderby family.Name
													   select family;

				foreach (FontFamily family in fontFamilies)
				{
					// The .NET framework is unforgiving of using a font that doesn't support the
					// "regular"  style.  So we won't allow the user to even see them...
					if (family.IsStyleAvailable(FontStyle.Regular))
					{
						string familyName = family.Name;
						m_defaultFontComboBox.Items.Add(familyName);
						family.Dispose();
					}
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:32,代码来源:DefaultFontsControl.cs

示例7: IsFontInstalled

 private static bool IsFontInstalled(string name)
 {
     using (var fonts = new InstalledFontCollection())
     {
         return fonts.Families.Any(x => x.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));
     }
 }
开发者ID:nitrocaster,项目名称:xrConsole,代码行数:7,代码来源:Program.cs

示例8: RichTextEditor

		/// <summary>
		/// The default constructor.
		/// </summary>
		public RichTextEditor()
		{
			InitializeComponent();

			m_tsbJustifications = new ToolStripButton[] { tsbJustifyLeft, tsbJustifyCentre, tsbJustifyRight };
			tsbJustifyLeft.Tag = HorizontalAlignment.Left;
			tsbJustifyCentre.Tag = HorizontalAlignment.Center;
			tsbJustifyRight.Tag = HorizontalAlignment.Right;
			tsbJustifyLeft.Checked = true;

			InstalledFontCollection ifcInstalledFonts = new InstalledFontCollection();
			foreach (FontFamily ffmFont in ifcInstalledFonts.Families)
				if (ffmFont.IsStyleAvailable(FontStyle.Regular))
				{
					tscbFont.Items.Add(ffmFont);
					if (ffmFont.Name.Equals(rtbTextbox.SelectionFont.Name))
						tscbFont.SelectedItem = ffmFont;
				}
			tscbFont.ComboBox.DisplayMember = "Name";
			tscbFont.ComboBox.ValueMember = "Name";
			m_intLastFontIndex = tscbFont.SelectedIndex;

			tscbFontSize.ComboBox.DataSource = FONT_SIZES;
			m_fltLastFontSize = float.Parse(tscbFontSize.Text);

			tsbBold.Tag = FontStyle.Bold;
			tsbItalic.Tag = FontStyle.Italic;
			tsbUnderline.Tag = FontStyle.Underline;
			tsbStrikeout.Tag = FontStyle.Strikeout;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:33,代码来源:RichTextEditor.cs

示例9: LoadSystemFonts

        /// <summary>
        /// Load system fonts and create previews of them
        /// </summary>
        /// <returns>Total number of fonts loaded</returns>
        public int LoadSystemFonts()
        {
            FontCollection fc = new InstalledFontCollection();
            int fontCount = 0;

            foreach (FontFamily f in fc.Families)
            {
                fontCount++;

                try
                {
                    FontStyle fs = FontStyle.Strikeout;
                    foreach (FontStyle fos in Enum.GetValues(typeof(FontStyle)))
                    {

                        if (fs == FontStyle.Strikeout && fos != FontStyle.Strikeout)
                        {
                            if (f.IsStyleAvailable(fos))
                            {
                                fs = fos;
                            }
                        }
                    }
                    Font fo = new Font(f, 38f, fs);
                    FamilyViewer fv = new FamilyViewer();
                    fv.PreviewFont = fo;
                    this.AddItem(fv);
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine("Problem displaying " + f.Name);
                }
            }
            return fontCount;
        }
开发者ID:vdtdev,项目名称:FontFish,代码行数:39,代码来源:FamilyGrid.cs

示例10: FromName

        public static Font FromName(string fontName)
        {
            Font font = null;
            var fontFamilyDesc = Pango.FontDescription.FromString (fontName);
            FontStyle style = FromPangoStyle (fontFamilyDesc.Style, fontFamilyDesc.Weight);

            /// Seriously, what the fuck?
            int notBullshitSize = (int)(fontFamilyDesc.Size / Pango.Scale.PangoScale);

            /// The chooser shows these options but they won't resolve automagically
            /// a installed font. Bit balls.
            if (fontFamilyDesc.Family == "Mono") {
                font = new Font (FontFamily.GenericMonospace, notBullshitSize, style);
            } else if (fontFamilyDesc.Family == "Sans") {
                font = new Font (FontFamily.GenericSansSerif, notBullshitSize, style);
            } else if (fontFamilyDesc.Family == "Serif") {
                font = new Font (FontFamily.GenericSerif, notBullshitSize, style);
            } else {
                InstalledFontCollection installedFonts = new InstalledFontCollection ();
                var test = new FontFamily (fontFamilyDesc.Family, installedFonts);
                font = new Font (test, fontFamilyDesc.Size);
            }

            return font;
        }
开发者ID:jasemagee,项目名称:FontWhiz,代码行数:25,代码来源:FontResolver.cs

示例11: CheckforFonts

        public static void CheckforFonts()
        {
            string[] fonts = {"arial"};
            bool [] found = new bool[fonts.Length];

            for (int i=0; i<found.Length; i++) {
                found [i] = false;

            }

            InstalledFontCollection ifc = new InstalledFontCollection ();
            foreach (FontFamily fm in  ifc.Families) {
                for (int i = 0; i <  fonts.Length; i++) {
                    if (fm.Name.ToLower () == fonts [i].ToLower ()) {
                        found [i] = true;
                    }
                }
            }

            for (int i=0; i<found.Length; i++) {
                if(!found[i]){
                    Console.WriteLine("Unable to load font :"+fonts[i]);
                }
            }
        }
开发者ID:pdabbadabba,项目名称:Beatdown,代码行数:25,代码来源:Program.cs

示例12: FormSheetDef_Load

		private void FormSheetDef_Load(object sender,EventArgs e) {
			setHeightWidthMin();
			if(IsReadOnly){
				butOK.Enabled=false;
			}
			if(!IsInitial){
				listSheetType.Enabled=false;
			}
			textDescription.Text=SheetDefCur.Description;
			_listSheetTypeIndexes=new List<int>();
			//not allowed to change sheettype once created.
			for(int i=0;i<Enum.GetNames(typeof(SheetTypeEnum)).Length;i++){
				if((SheetTypeEnum)i==SheetTypeEnum.MedLabResults) {
					continue;
				}
				listSheetType.Items.Add(Enum.GetNames(typeof(SheetTypeEnum))[i]);
				_listSheetTypeIndexes.Add(i);
				if((int)SheetDefCur.SheetType==i && !IsInitial){
					listSheetType.SelectedIndex=listSheetType.Items.Count-1;
				}
			}
			InstalledFontCollection fColl=new InstalledFontCollection();
			for(int i=0;i<fColl.Families.Length;i++){
				comboFontName.Items.Add(fColl.Families[i].Name);
			}
			comboFontName.Text=SheetDefCur.FontName;
			textFontSize.Text=SheetDefCur.FontSize.ToString();
			textWidth.Text=SheetDefCur.Width.ToString();
			textHeight.Text=SheetDefCur.Height.ToString();
			checkIsLandscape.Checked=SheetDefCur.IsLandscape;
		}
开发者ID:mnisl,项目名称:OD,代码行数:31,代码来源:FormSheetDef.cs

示例13: FormSheetFieldDefEdit_Load

		private void FormSheetFieldDefEdit_Load(object sender,EventArgs e) {
			if(IsReadOnly){
				butOK.Enabled=false;
				butDelete.Enabled=false;
			}
			//not allowed to change sheettype or fieldtype once created.  So get all avail fields for this sheettype
			AvailFields=SheetFieldsAvailable.GetList(SheetDefCur.SheetType,OutInCheck.Out);
			listFields.Items.Clear();
			for(int i=0;i<AvailFields.Count;i++){
				//static text is not one of the options.
				listFields.Items.Add(AvailFields[i].FieldName);
				if(SheetFieldDefCur.FieldName==AvailFields[i].FieldName){
					listFields.SelectedIndex=i;
				}
			}
			InstalledFontCollection fColl=new InstalledFontCollection();
			for(int i=0;i<fColl.Families.Length;i++){
				comboFontName.Items.Add(fColl.Families[i].Name);
			}
			comboFontName.Text=SheetFieldDefCur.FontName;
			textFontSize.Text=SheetFieldDefCur.FontSize.ToString();
			checkFontIsBold.Checked=SheetFieldDefCur.FontIsBold;
			for(int i=0;i<Enum.GetNames(typeof(GrowthBehaviorEnum)).Length;i++){
				comboGrowthBehavior.Items.Add(Enum.GetNames(typeof(GrowthBehaviorEnum))[i]);
				if((int)SheetFieldDefCur.GrowthBehavior==i){
					comboGrowthBehavior.SelectedIndex=i;
				}
			}
			textXPos.Text=SheetFieldDefCur.XPos.ToString();
			textYPos.Text=SheetFieldDefCur.YPos.ToString();
			textWidth.Text=SheetFieldDefCur.Width.ToString();
			textHeight.Text=SheetFieldDefCur.Height.ToString();
		}
开发者ID:romeroyonatan,项目名称:opendental,代码行数:33,代码来源:FormSheetFieldOutput.cs

示例14: MainForm_Load

        private void MainForm_Load(object sender, EventArgs e)
        {
            // init fonts
            var fonts = new InstalledFontCollection();
            var families = fonts.Families;
            cbFonts.DataSource = families;
            cbFonts.DisplayMember = "Name";

            // look for the initial font
            FontFamily initialFamily = families.FirstOrDefault(x => x.Name == "Arial");
            if (initialFamily != default(FontFamily)) cbFonts.SelectedItem = initialFamily;

            // init font sizes
            cbBrandFontSize.DataSource = GetStandardFontSizes();
            cbBrandFontSize.SelectedItem = 48;

            cbNameSize.DataSource = GetStandardFontSizes();
            cbNameSize.SelectedItem = 26;

            cbBottomSize.DataSource = GetStandardFontSizes();
            cbBottomSize.SelectedItem = 36;

            progress.Maximum = 100;

            //Uri test = new Uri("http://www.zappos.com/jack-by-bb-dakota-daniela-dress-black");
            //string data = Web.GetContent(test);
            //Console.WriteLine(data.Length);
        }
开发者ID:Infarch,项目名称:MyPerlModules,代码行数:28,代码来源:MainForm.cs

示例15: FontSelectionControl

        public FontSelectionControl()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            for (int i = 6; i <= 24; ++i)
            {
                cbFontSize.Items.Add(i);
            }
            InstalledFontCollection installedFontCollection = new InstalledFontCollection();
            List<string> fonts = new List<string>();
            foreach (FontFamily fontFamily in installedFontCollection.Families)
            {
                if (fontFamily.IsStyleAvailable(FontStyle.Regular) &&
                        fontFamily.IsStyleAvailable(FontStyle.Bold)  &&
                        fontFamily.IsStyleAvailable(FontStyle.Italic)
                    )
                    fonts.Add(fontFamily.Name);
            }
            fonts.Sort();
            cbFontName.Items.AddRange(fonts.ToArray());

            RegisterLanguageEvent(OnLanguageChanged);
        }
开发者ID:cyotek,项目名称:translateclient,代码行数:26,代码来源:FontSelectionControl.cs


注:本文中的System.Drawing.Text.InstalledFontCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。