首页 »DotNet » 如何用word绘制表格:C#用Graphics绘制雪人 »正文
如何用word绘制表格:C#用Graphics绘制雪人
来源: 发布时间:星期五, 2009年2月20日 浏览:0次 评论:0
在网上看到 段代码 觉得有意思 就修改了下共享CSDN读友
运行界面:
在看代码:
view plaincopy to clipboardpr ?
="dp-c">
="alt"> ="keyword">private="keyword">void prDramC(Graphicsg)
=""> {
="alt"> ="keyword">const ="keyword"> MID=150;
=""> ="keyword">const ="keyword"> Top=50;
="alt"> ="keyword">this .Text==" ">"simplegraphicssnowman" ;
="">
="alt"> Fontfont=="keyword"> Font(=" ">"隶书" ,17);
="">
="alt"> Penblue=="keyword"> Pen(Color.Blue);
=""> Penyellow=="keyword"> Pen(Color.Yellow);
="alt"> Penwhite=="keyword"> Pen(Color.White);
=""> Penred=="keyword"> Pen(Color.Red);
="alt"> Penblack=="keyword"> Pen(Color.Black);
=""> BrushbrWhite=white.Brush;
="alt"> BrushbrBlack=black.Brush;
=""> BrushbrRed=red.Brush;
="alt">
=""> g.FillRectangle(brRed,20,30,30,120);
="alt"> g.FillRectangle(brRed,250,30,30,120);
=""> g.FillRectangle(brRed,100,0,100,25);
="alt">
=""> StringFormatformat=="keyword"> StringFormat;
="alt"> format.FormatFlags=StringFormatFlags.DirectionVertical;
="">
="alt"> g.DrawString(=" ">" 3杯祝福歌" ,font,brBlack,250,30,format);
=""> g.DrawString(=" ">" 曲迎春调" ,font,brBlack,20,30,format);
="alt"> g.DrawString(=" ">"迎春祝福" ,font,brBlack,100,0);
="">
="alt"> g.DrawRectangle(blue,0,175,300,50);="comment">//sky
=""> g.DrawEllipse(yellow,-40,-40,80,80);="comment">//sun
="alt"> g.FillEllipse(brWhite,MID-20,Top,40,40);="comment">//head
=""> g.FillEllipse(brWhite,MID-35,Top+35,70,50);="comment">//top
="alt"> g.FillEllipse(brWhite,MID-50,Top+80,100,60);="comment">//bot
=""> g.FillEllipse(brBlack,MID-10,Top+10,5,5);="comment">//l.eye
="alt"> g.FillEllipse(brBlack,MID+5,Top+10,5,5);="comment">//r.eye
=""> g.DrawArc(black,MID-10,Top+20,20,10,-190,-160);="comment">//(:
="alt"> ="comment">//arms
=""> g.DrawLine(black,MID-25,Top+60,Top-50,MID+40);
="alt"> g.DrawLine(black,MID+25,Top+60,MID+55,Top+60);
="">
="alt"> g.DrawLine(black,MID-20,Top+5,MID+20,Top+5);="comment">//hat,brim,top
=""> g.FillRectangle(brBlack,MID-15,Top-20,30,25);
="alt"> }
相关文章
读者评论
发表评论
|
|