2011年7月30日
摘要:
View Code staticvoidMain(string[]args){List<Person>personL=newList<Person>();personL.Add(newPerson("wtq","男","13616009873",23));personL.Add(newPerson("wta","女","13616009871",24));personL.Add(newPerson("wtb","男&quo
阅读全文
posted @ 2011-07-30 16:15
wtq
阅读(875)
推荐(1)
摘要:
绘制多行文本,如图:思路主要设置drawstring的第二个参数的高度,这样就ok了。代码如下;View Code //privatevoidForm1_Paint(objectsender,PaintEventArgse)//{//Graphicsg=e.Graphics;//FontFamilyff=newFontFamily(GenericFontFamilies.Serif);//Fontf=newFont(ff,12,FontStyle.Italic|FontStyle.Bold|FontStyle.Strikeout|FontStyle.Underline);//stringst.
阅读全文
posted @ 2011-07-30 01:21
wtq
阅读(825)
推荐(0)
摘要:
绘制有边框的字体,如图思路,通过stringMessure来获取字体的长度。如下:View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;FontFamilyff=newFontFamily(GenericFontFamilies.Serif);Fontf=newFont(ff,12,FontStyle.Italic);stringstr="Height"+f.Height;//不添加而外的高度SizeFsf=g.MeasureString(str,f,int.M
阅读全文
posted @ 2011-07-30 00:59
wtq
阅读(1387)
推荐(0)
2011年7月29日
摘要:
下面将演示如何使用窗体的默认字体。 privatevoidForm1_Paint(objectsender,PaintEventArgse){FontFamilyff=newFontFamily(GenericFontFamilies.SansSerif);Fontf=newFont(ff,13,GraphicsUnit.Millimeter);Fontf1=newFont(ff,13,GraphicsUnit.Point);using(Fontf2=newFont(ff,23,FontStyle.Strikeout)){Graphicsg=e.Graphics;g.DrawString(&q
阅读全文
posted @ 2011-07-29 23:58
wtq
阅读(481)
推荐(0)
摘要:
可通过钢笔和笔刷混合 使用绘制出有边框的填充图案,如图:代码如下:View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;HatchBrushhb=newHatchBrush(HatchStyle.NarrowHorizontal,Color.Blue,Color.White);LinearGradientBrushlgb=newLinearGradientBrush(newPoint(2,2),newPoint(19,2),Color.Blue,Color.Brown);Penh.
阅读全文
posted @ 2011-07-29 21:52
wtq
阅读(406)
推荐(1)
摘要:
先上图:提示:可通过笔刷来创建钢笔并绘制图形,以上是通过HatchBrush 来创建钢笔的。View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;HatchBrushhb=newHatchBrush(HatchStyle.NarrowHorizontal,Color.Red,Color.White);Penhp=newPen(hb,8);g.DrawRectangle(hp,12,12,200,200);hb.Dispose();}还可以通过LinearGridentBrush来.
阅读全文
posted @ 2011-07-29 21:40
wtq
阅读(476)
推荐(0)
摘要:
先上图:通过hatchbrush根据图案来填充,可通过HatchStyle枚举来设置图案。 代码如下:View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;HatchBrushhb=newHatchBrush(HatchStyle.OutlinedDiamond,Color.Red,Color.White);g.FillRectangle(hb,ClientRectangle);hb.Dispose();}
阅读全文
posted @ 2011-07-29 20:51
wtq
阅读(353)
推荐(0)
摘要:
通过路径渐变画刷来绘制图片代码如下:View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;GraphicsPathgp=newGraphicsPath();Point[]p=newPoint[]{newPoint(10,10),newPoint(100,30),newPoint(50,100)};gp.AddLines(p);PathGradientBrushpgb=newPathGradientBrush(gp);pgb.CenterColor=Color.White;pgb..
阅读全文
posted @ 2011-07-29 20:40
wtq
阅读(1571)
推荐(0)
摘要:
在linq 中实现 sql 中的in查询时,可以使用如下语句:View Code ///intPropertySetId))();}Ls.ToList();<summary>///根据行业id获得属性集名///</summary>///<paramname="strPropertySetId"></param>///<returns></returns>publicList<string>GetHyNametByPromotionForWeb(List<int?>{if(intP
阅读全文
posted @ 2011-07-29 14:38
wtq
阅读(5337)
推荐(0)
2011年7月28日
摘要:
以下介绍pen的一些属性:1.画笔绘制方式Pen.Alignment 属性设置当钢笔的宽度超过1像素的时候,该如何绘制有Center,Inset ,Outset,Left,right。View Code Pena=newPen(Color.Tomato,20);a.Alignment=PenAlignment.Outset;g.DrawRectangle(a,50,50,100,100);2.定制短划线:View Code Pena=newPen(Color.Tomato,1);a.Alignment=PenAlignment.Outset;float[]f={15,5,10,2,30,10.
阅读全文
posted @ 2011-07-28 15:40
wtq
阅读(499)
推荐(0)