GDI+基础知识——画笔的线帽属性示意
2012-12-10 20:51
190 查看
//线帽演示
private void Pen_LineCap_Click(object sender, System.EventArgs e)
{
Graphics graphics = this.CreateGraphics();
graphics.Clear(Color.White);
//设置文本输出对齐方式及字体
StringFormat fmt = new StringFormat();
fmt.Alignment = StringAlignment.Near;
fmt.LineAlignment = StringAlignment.Center;
//字体
Font font = new Font("Arial",12);
SolidBrush sBrush = new SolidBrush(Color.Red);
//创建宽度为15的画笔
Pen pen = new Pen(Color.Black,15);
//分别使用不同的线帽
foreach (LineCap lincap in Enum.GetValues(typeof(LineCap)))
{
pen.StartCap = lincap;//起点
pen.EndCap = lincap;//终点
graphics.DrawLine(pen,50,10,300,10);
//输出当前线帽类型(LineCap枚举成员名)
graphics.DrawString(pen.StartCap.ToString(),
font,sBrush,new Point(320,10),fmt);
//平移绘图平面
graphics.TranslateTransform(0,30);
}
}
相关文章推荐
- GDI+基础知识——通过画刷构建画笔
- GDI+基础知识——各种画笔线型
- GDI+基础知识——画笔的对齐方式
- GDI+基础知识——画笔的变换(缩放及旋转)
- HTML5基础知识汇总_(2)自定义属性及表单新特性
- dreamweaver的学习 【基础知识】2定义站点页面属性
- oc基础知识:属性、协议和分类
- 15_Linux基础知识及命令――――修改用户、组的属性和查看用户信息
- GDI+ 基础知识入门
- spring技术框架基础知识三属性编辑器
- JS中的事件类型和事件属性的基础知识
- Linux基础知识+文件属性权限+FHS+目录树
- c#基础知识---文件属性与文件路径操作
- 【一天一篇CPP】继承和派生:基础知识和继承方式与访问属性
- Objective-C 基础知识之 (十四):属性 Property 点语法
- H5基础知识第十课时(Window对象常用的属性)
- XPath可以快速定位到Xml中的节点或者属性。XPath语法很简单,但是强大够用,它也是使用xslt的基础知识。
- jQuery基础知识— 获得内容和属性
- SQLServer学习笔记<>.基础知识,一些基本命令,单表查询(null top用法,with ties附加属性,over开窗函数),排名函数
- 基础知识备忘——字段(Field),属性(Property),特性(Attribute)