* 程序的版权和版本声明部分
* Copyright (c) 2012, 烟台大学计算机学院学生
* All rights reserved.
* Copyright (c) 2012, 烟台大学计算机学院学生
* All rights reserved.
* 作 者: 刘镇
* 完成日期: 2012 年 11 月 25 日
* 版 本 号: 3.031
* 对任务及求解方法的描述部分
* 问题描述:实现绘制文字
*代码部分:
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Win11_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
TextureBrush brush = new TextureBrush(Image.FromFile("001.jpg"));
Font font = new Font("宋体", 60, FontStyle.Underline ^ FontStyle.Bold);
g.DrawString("呵呵!C#", font, brush, new Point(80, 10));
}
}
}
测试结果:

本文介绍了一个使用C#绘制文字的基本示例。通过Form1类,在窗体加载时设置绘图事件,利用Graphics对象绘制带纹理填充的文字,字体为加粗并下划线的宋体。
----绘制文字&spm=1001.2101.3001.5002&articleId=8221830&d=1&t=3&u=12a1cebe85e64ef0ae6a4fb3ad8f28f3)
556

被折叠的 条评论
为什么被折叠?



