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


C# Drawing.Font类代码示例

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


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

示例1: repaintNodes

        // prekresli sa vrchol
        private void repaintNodes(KDNode n)
        {
            System.Drawing.Font font = new System.Drawing.Font("Verdana", 10);
            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Black);

            if (n.highlight)
            {
                myBrush.Color = System.Drawing.Color.Green;
                myPen.Color = System.Drawing.Color.Green;
            }

            if (n.highlightRed)
            {
                myBrush.Color = System.Drawing.Color.Red;
                myPen.Color = System.Drawing.Color.Red;
            }
            if (n.highligthIn)
            {
                myBrush.Color = System.Drawing.Color.Red;
                myPen.Color = System.Drawing.Color.Red;
                g.DrawEllipse(myPen, n.getPoint().X - (RADIUS + 2), n.getPoint().Y - (RADIUS + 2), 2 * (RADIUS + 2), 2 * (RADIUS + 2));
                myPen.Color = System.Drawing.Color.Black;
            }

            g.FillEllipse(myBrush, n.getPoint().X - RADIUS, n.getPoint().Y - RADIUS, 2*RADIUS, 2*RADIUS);

            string s = "(" + n.getPoint().X.ToString() + "," + n.getPoint().Y.ToString() + ")";
            g.DrawString(s, font, myBrush, n.getPoint().X - 35, n.getPoint().Y);
        }
开发者ID:katarinka,项目名称:kDTree,代码行数:31,代码来源:PointPainter.cs

示例2: InsertExcel

        public bool InsertExcel(string titleName, string unit, GridControl gridControl, TONLI.BZH.UI.DSOFramerWordControl wordcontrol)
        {
            try
            {
                System.Drawing.Font font = new System.Drawing.Font("���ו", 16);
                wordcontrol.DoInsert("\n\n"+titleName+"\n"  , font, TONLI.BZH.UI.WdParagraphAlignment.Center);
                //wordcontrol.DoPaste();

                font = new System.Drawing.Font("���ו", 12);
                wordcontrol.DoInsert(unit + "\n", font, TONLI.BZH.UI.WdParagraphAlignment.Right);
                //wordcontrol.DoPaste();

                wordcontrol.DoInsert("", font, TONLI.BZH.UI.WdParagraphAlignment.Center);
                string filename =System.Windows.Forms.Application.StartupPath + "\\BlogData\\Blog.xls";
                gridControl.DefaultView.ExportToExcelOld(filename);

                wordcontrol.DoInsertOleObject(filename);
                //System.Drawing.Font font = new System.Drawing.Font("���ו", 16);
                wordcontrol.DoInsert("", font, TONLI.BZH.UI.WdParagraphAlignment.Center);
                //Microsoft.Office.Interop.Excel.Application ep = new Microsoft.Office.Interop.Excel.Application();

                //Microsoft.Office.Interop.Excel._Workbook wb = ep.Workbooks.Add(filename);

                //Microsoft.Office.Interop.Excel.Sheets sheets = wb.Worksheets;

                //Microsoft.Office.Interop.Excel._Worksheet ws = (Microsoft.Office.Interop.Excel._Worksheet)sheets.get_Item(1);// [System.Type.Missing];//.get.get_Item("xx");
                //ws.UsedRange.Select();
                //ws.UsedRange.Copy(System.Type.Missing);

                //wordcontrol.DoPaste();

                return true;
            }
            catch { return false; }
        }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:35,代码来源:LayoutsClass.cs

示例3: DrawingFont

	public DrawingFont(IToolkit toolkit, System.Drawing.Font properties, float dpi)
	{
		this.toolkit = toolkit;
		this.properties = properties;
		this.dpi = dpi;
		CreateFont();
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:DrawingFont.cs

示例4: m_printDocument_PrintPage

        void m_printDocument_PrintPage(object sender, PrintPageEventArgs e)
        {
            SelectedMealCollection colData = (SelectedMealCollection)this.FindResource("SelectedMealCollectionData");
            float leftMargin = e.MarginBounds.Left;
            float rightMargin = e.MarginBounds.Right;
            float topMargin = e.MarginBounds.Top;
          
            float yPos = leftMargin;
            float xPos = 0;
            float centrePos = 2 * (rightMargin - leftMargin) / 5;
            float rightPos =  4 * (rightMargin - leftMargin) / 5;
            int count = 0;

            System.Drawing.Font printFont = new System.Drawing.Font("Arial", 10);
            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);

            // Work out the number of lines per page, using the MarginBounds.
            float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);
            float lineCount = 0;
            foreach (var selectedMeal in colData)
            {
                // calculate the next line position based on the height of the font according to the printing device
                yPos = topMargin + (count++ * printFont.GetHeight(e.Graphics));
                e.Graphics.DrawString(selectedMeal.Date, printFont, myBrush, xPos, yPos);
                lineCount++;
   
                yPos = topMargin + (count++ * printFont.GetHeight(e.Graphics));
                e.Graphics.DrawString(selectedMeal.Meal, printFont, myBrush, xPos + 20, yPos);

                lineCount++;

                if (lineCount > linesPerPage) { break; }
            }

            lineCount = 0;
            count = 0;

            SelectedIngredientsCollection ingredientData = (SelectedIngredientsCollection)this.FindResource("SelectedIngredientsCollectionData");

            foreach (SelectedIngredient ingredient in ingredientData)
            {               
                // calculate the next line position based on the height of the font according to the printing device
                yPos = topMargin + (count++ * printFont.GetHeight(e.Graphics));
                xPos = centrePos;
                if (lineCount > linesPerPage) xPos = rightPos;
                e.Graphics.DrawString(ingredient.Ingredient, printFont, myBrush, xPos, yPos);
                lineCount++;
            }

            // If there are more lines, print another page.
            if (lineCount > linesPerPage)
            {
           //     e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
                myBrush.Dispose();
            }
        }
开发者ID:jscott7,项目名称:SuperMarketPlanner,代码行数:60,代码来源:MainWindow.xaml.cs

示例5: BaseNavMin

 public BaseNavMin(
     System.Windows.Forms.Control parentpal,
     System.Drawing.Size size,
     System.Drawing.Point point,
     float fontSize,
     System.Drawing.Color backcolor,
     System.Drawing.Color backlight,
     System.Drawing.Color forecolor,
     System.Drawing.Color forelight,
     System.Windows.Forms.AnchorStyles anchorstyle
     )
 {
     Backlight = backlight;
     Forelight = forelight;
     BackColor = Backcolor = backcolor;
     ForeColor = Forecolor = forecolor;
     Size = size;
     Location = point;
     Text = @"-";
     TextAlign = Helper.Align;
     Cursor = Helper.HCursors;
     Font = new System.Drawing.Font(Helper.FontSymbol, fontSize);
     Anchor = anchorstyle;
     parentpal.Controls.Add(this);
     MouseClick += BaseNavMin_MouseClick;
     MouseLeave += BaseNavMin_MouseLeave;
     MouseUp += BaseNavMin_MouseUp;
     MouseDown += BaseNavMin_MouseDown;
     MouseHover += BaseNavMin_MouseHover;
 }
开发者ID:RyanFu,项目名称:A51C1B616A294D4BBD6D3D46FD7F78A7,代码行数:30,代码来源:BaseNav.cs

示例6: GetFontId

        private int GetFontId(FontDescriptor fd)
        {
            var fontId = String.Intern(fd.Id);

            var index = m_registeredFonts.FindIndex(fm => Object.ReferenceEquals(fm.m_id, fontId));
            if (index == -1)
            {
                var fontObject = new Font(fd.FamilyName, fd.Size, fd.Style);
                m_registeredFonts.Add(new FontMetrics
                {
                    m_id = fontId,
                    m_fontObject = fontObject,
                    m_outlineThickness = fd.OutlineThickness,
                    m_spaceWidth = MeasureSpace(fontObject).Width,
                    m_fullWidthSpaceWidth = MeasureFullwidthSpace(fontObject).Width,
                    m_ascentInPixels = CalculateAscentInPixel(fontObject)
                });
                index = m_registeredFonts.Count - 1;
            }

            if (index > 0xffff)
            {
                throw new OverflowException("Number of registered font has grown ridiculously too large.");
            }

            return index;
        }
开发者ID:galaxyyao,项目名称:TouhouGrave,代码行数:27,代码来源:TextRenderer.Fonts.cs

示例7: LoadingProcess

        private void LoadingProcess(object param)
        {
            LoadingResourcesDlg dlg = (LoadingResourcesDlg)param;
            try
            {
                // load symbols for elements
                ElementPTFactory elements = ElementPTFactory.Instance;
                System.Drawing.Font font = new System.Drawing.Font("Tahoma", 20);
                float onePer = 100.0f / elements.Size;
                float prog = 0;
                foreach (PeriodicTableElement element in elements)
                {
                    Texture tex = TextTexture.DrawTextToTexture(element.Symbol,
                                                font, device, 64, 64).Texture;

                    symbolTextures[element.Symbol] = tex;

                    prog += onePer;
                    dlg.Progress = (int)prog;
                }

                dlg.TryClose();
            }
            catch { }
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:25,代码来源:ChemSymbolTextures.cs

示例8: DrawBinaryImage

        //BinaryWrite方法将一个二进制字符串写入HTTP输出流
        //public void BinaryWrite(byte[] buffer)
        public void DrawBinaryImage()
        {
            //要绘制的字符串
            string word = "5142";

            //设定画布大小,Math.Ceiling向上取整
            int width = int.Parse(Math.Ceiling(word.Length * 20.5).ToString());
            int height = 22;

            //创建一个指定大小的画布
            System.Drawing.Bitmap image = new System.Drawing.Bitmap(width, height);
            //创建一个指定的GDI+绘图图面
            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
            try
            {
                //用白色填充图面
                g.Clear(System.Drawing.Color.White);

                //绘制背景噪音线
                Random r = new Random();
                int x1, x2, y1, y2;
                for (int i = 0; i < 2; i++)
                {
                    x1 = r.Next(image.Width);
                    x2 = r.Next(image.Width);
                    y1 = r.Next(image.Height);
                    y2 = r.Next(image.Height);
                    g.DrawLine(new System.Drawing.Pen(System.Drawing.Color.Black), x1, y1, x2, y2);
                }

                //绘制文字
                System.Drawing.Font font = new System.Drawing.Font("Arial", 12, (System.Drawing.FontStyle.Bold));
                System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush
                                                        (new System.Drawing.Rectangle(0, 0, image.Width, image.Height),
                                                        System.Drawing.Color.Blue, System.Drawing.Color.DarkRed, 5.2f, true);
                g.DrawString(word, font, brush, 2, 2);

                //绘制前景噪点
                int x, y;
                for (int i = 0; i < 100; i++)
                {
                    x = r.Next(image.Width);
                    y = r.Next(image.Height);
                    image.SetPixel(x, y, System.Drawing.Color.FromArgb(r.Next()));
                }

                //绘制边框
                g.DrawRectangle(new System.Drawing.Pen(System.Drawing.Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
                System.IO.MemoryStream ms = new MemoryStream();
                image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
                Response.ClearContent();
                Response.ContentType = "image/Gif";
                Response.BinaryWrite(ms.ToArray());
            }
            catch (Exception)
            {
                g.Dispose();
                image.Dispose();
            }
        }
开发者ID:ZhuangChen,项目名称:CSharpBasicTraining,代码行数:62,代码来源:04Built-in_Object.aspx.cs

示例9: CustomListViewItem

 public CustomListViewItem()
 {
     // Customize the ListViewItem control by setting various properties.
     BackColor = System.Drawing.Color.White;
     Font = new System.Drawing.Font("Arial", 15, System.Drawing.FontStyle.Bold);
     ForeColor = System.Drawing.Color.Gray;
 }
开发者ID:soumyaansh,项目名称:Outlook-Widget,代码行数:7,代码来源:CustomListViewItem.cs

示例10: OnMouseWheel

 // Change the font size
 //
 protected override void OnMouseWheel(MouseEventArgs e)
 {
     base.OnMouseWheel(e);
     if (e.Delta > 0)
         Font = new System.Drawing.Font(Font.FontFamily, Font.Size + 0.2f);
     else
         Font = new System.Drawing.Font(Font.FontFamily, Font.Size - 0.2f);
 }
开发者ID:vladmikhbond,项目名称:Plagiarism,代码行数:10,代码来源:MainForm.cs

示例11: TextCord

 public TextCord(string st, float x, float y, System.Drawing.Font f, System.Drawing.Brush b)
 {
     X = x;
     Y = y;
     font = f;
     brush = b;
     str = st;
 }
开发者ID:OsAnYa,项目名称:GeneticAlgorithm,代码行数:8,代码来源:TextCord.cs

示例12: LibrarySpinEdit

 public LibrarySpinEdit()
 {
     Properties.EditMask = "F0";
     Properties.MinValue = 0;
     Value = 0;
     Properties.MaxValue = 2000000000;
     Font = new System.Drawing.Font("Tahoma", 9, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
     Properties.IsFloatValue = false;
 }
开发者ID:BlackieLawless,项目名称:Library,代码行数:9,代码来源:LibrarySpinEdit.cs

示例13: SetFont

 public static void SetFont()
 {
     FontDialog fd = new FontDialog();
     if(sysfont!=null)fd.Font = sysfont;
     if (fd.ShowDialog() == DialogResult.OK)
     {
         sysfont = fd.Font;
     }
 }
开发者ID:eddylin2015,项目名称:sportday,代码行数:9,代码来源:Lib.cs

示例14: CustomRichTextBox

        public CustomRichTextBox() {

            BackColor = System.Drawing.Color.WhiteSmoke;
            Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Regular);
            Size = new System.Drawing.Size(460, 457);
            Location = new System.Drawing.Point(0, 0);
            WordWrap = true;
            ReadOnly = true;
        }
开发者ID:soumyaansh,项目名称:Outlook-Widget,代码行数:9,代码来源:CustomRichTextBox.cs

示例15: GetFont

 public System.Drawing.Font GetFont(Styles.Font font)
 {
     System.Drawing.Font gdiFont;
     if (!fonts.TryGetValue(font, out gdiFont))
     {
         gdiFont = new System.Drawing.Font(font.FontFamily, (float)font.Size);
     }
     return gdiFont;
 }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:9,代码来源:StyleContext.cs


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