摘要:
使用InstalledFontCollection来获得电脑已经安装的字体有哪些。如图;代码如下:View Code 1//查看电脑有多少字体2privatevoidForm1_Paint(objectsender,PaintEventArgse)3{4FontFamily[]fontfamilys;5InstalledFontCollectioninstalledFontCollection=newInstalledFontCollection();6fontfamilys=installedFontCollection.Families;7foreach(variteminfontfami 阅读全文
摘要:
以下将采用十字架来绘制字体。如图:1.思路,先创建图案笔刷,然后再绘制图形。代码如下: View Code 1privatevoidForm1_Paint(objectsender,PaintEventArgse)2{3Graphicsg=e.Graphics;45Fontf=newFont("Aries",60,FontStyle.Bold);6HatchBrushhb=newHatchBrush(HatchStyle.Cross,Color.Blue,Color.Gray);7g.DrawString("我叫王王王",f,hb,0f,20f);8g. 阅读全文
摘要:
先上图;2,使用StringFormat中的SetTabStops来设置制表位所占的空间StringFormat sf = new StringFormat(); sf.StTabStops(5f, ff);代码如下:View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;Fontf=newFont("Aries",15,FontStyle.Italic);Fontfb=newFont(f,FontStyle.Bold);strings1="\twtq\ 阅读全文
摘要:
可通过以下语句来设置文本的对齐方式:StringFormat sF = new StringFormat()sF.Alignment = StringAlignment.Far;sF.LineAlignment = StringAlignment.Far;代码:、View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;Fontf=newFont("Aris",15,FontStyle.Italic);strings="thisismyname" 阅读全文
摘要:
可通过StringFormat sF = new StringFormat(StringFormatFlags.DirectionVertical);以及使用 g.DrawString(s, f, Brushes.Black, rf,sF);来绘制竖向文本 View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;Fontf=newFont("Aris",15,FontStyle.Italic);strings="thisismyname,andwhat& 阅读全文
摘要:
1,主要利用MessageString()这个函数来实现自动换行。截图如下:代码如下:View Code //绘制有边框的字体,并自动换行privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;Fontf=newFont("Aris",15,FontStyle.Italic|FontStyle.Strikeout);strings="thisismyname,andwhataboutyou,oknoproblems,everyisok,somethingisgoods,pr 阅读全文