最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net中C#实现图片加带描边字体例子
时间:2015-03-25 编辑:简简单单 来源:一聚教程网
效果如下
代码如下
private Image loadFont(string pa)
{
Image bmap;
bmap = Image.FromFile(pa);
Graphics g = Graphics.FromImage(bmap);//在Image对象上创建Graphics对象
g.SmoothingMode = SmoothingMode.AntiAlias;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
GraphicsPath myPath = new GraphicsPath();
string stringText = this.textBox1.Text.Trim();
string Font = "";//字体
this.comboBox1.Invoke(new EventHandler(delegate
{
Font = this.comboBox1.Text;
}));
FontFamily family = new FontFamily(Font);
int fontStyle = (int)FontStyle.Bold;
int emSize = (int)numericUpDown3.Value;//字体大小
Point origin = new Point(10, 10);
StringFormat format = StringFormat.GenericDefault;
Brush bru = new SolidBrush(Color.FromArgb(241, 027, 039));
myPath.AddString(stringText,
family,
fontStyle,
emSize,
origin,
format);
g.FillPath(bru, myPath);
g.DrawPath(new Pen(Color.White, (float)numericUpDown1.Value), myPath);
//bmap.Save(@"d:/test.jpg");//将Image图片保存到本地
return bmap;
}
获取系统所有的字体
InstalledFontCollection MyFont = new InstalledFontCollection();
FontFamily[] MyFontFamilies = MyFont.Families;
int Count = MyFontFamilies.Length;
for (int i = 0; i < Count; i++)
{
this.comboBox1.Items.Add(MyFontFamilies[i].Name);
}
-
上一个: 使用GDB命令行调试器调试C/C++程序
-
下一个: C++ 复合类型学习笔记
相关文章
- asp.net C#中 PictureBox控件拖动与图片拖动代码 06-28
- asp.net C#图片缩放放大剪切代码 02-21
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18