在winform界面上直接输出文字内容,并控制文字的大小样式,请问怎么做?
解决方案 »
- 如何配置ODBC数据源
- List<Simple> list = new List<Simple>();怎么理解
- 关于断点
- ToT最后50分:DataGrdiView哪个事件去执行企业库UpdateDataset来更新数据库
- 求csdn博客中写文章的UBB编辑器
- 在c# 中 如何获取datagrid某个单元格的值????
- 关于事件及委托的编程题?
- 为什么我的TreeView进入页面时每次都要刷新一下才可以显示出来
- to:版主 ArLi2003、redbb,winform下checkedlistbox的selectionmode的属性为何不能选multisimple
- 怎么样检测word或者是excel的版本?
- 用C#写的windows服务程序如何重启自身
- 关于null的问题
方法二:在窗体中使用键盘捕获事件
l.text="";
l.位置 我忘记怎么写了 貌似是point(1 2)
然后在把l放from里就好了
SolidBrush aBrush = new SolidBrush(Color.Blue);
Font aFont = new Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Millimeter);
int xPos = 0;
int yPos = 0; Graphics graphic = this.CreateGraphics();
graphic.DrawString ("This is a font test!", aFont, aBrush, xPos, yPos);
写Form的Paint事件,如:
this.Paint += new System.Windows.Forms.PaintEventHandler(Form1_Paint);
void MainForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Font f = new Font("宋体", 10);
g.DrawString("你好!", f, Brushes.Black, 20, 20);}
希望可以帮到你
如果不想使用控件,直接在窗体上输出文字的话,可以考虑使用GDI+绘图法。
写Form的Paint事件,如:C# code
this.Paint += new System.Windows.Forms.PaintEventHandler(Form1_Paint);void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Font f = new Font("宋体", 10);
g.DrawString("你好!", f, Brushes.Black, 20, 20);} 希望可以帮到你