C#中GraphicsPath的AddString方法用法实例
本文实例讲述了C#中GraphicsPath的AddString方法用法。分享给大家供大家参考。具体如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace advanced_drawing
{
public partial class Form14 : Form
{
public Form14()
{
InitializeComponent();
}
private void Form14_Paint(object sender, PaintEventArgs e)
{
// Create a GraphicsPath object.
GraphicsPath myPath = new GraphicsPath();
// Set up all the string parameters.
string stringText = "Sample Text";
FontFamily family = new FontFamily("Arial");
int fontStyle = (int)FontStyle.Italic;
int emSize = 26;
Point origin = new Point(20, 20);
StringFormat format = StringFormat.GenericDefault;
// Add the string to the path.
myPath.AddString(stringText,
family,
fontStyle,
emSize,
origin,
format);
//Draw the path to the screen.
e.Graphics.FillPath(Brushes.Black, myPath);
}
}
}
希望本文所述对大家的C#程序设计有所帮助。
相关推荐
-
深入c# GDI+简单绘图的具体操作步骤(二)
在上一篇里已经向大家介绍了如何使用GDI+绘制简单的图像,这一片继续向大家介绍其它一些绘图知识.1.首先我们来看下上一片中我们使用过的Pen.Pen的属性主要有: Color(颜色),DashCap(短划线终点形状),DashStyle(虚线样式),EndCap(线尾形状), StartCap(线头形状),Width(粗细)等.我们可以用Pen 来画虚线,带箭头的直线等 复制代码 代码如下: Pen p = new Pen(Color.Blue, 5);//设置笔的粗细为,颜色为蓝色Grap
-
C#实现Windows Form调用R进行绘图与显示的方法
一.前提准备 安装R软件,需要安装32位的R软件,64位的调用会报错.另外就是讲R添加到电脑环境变量中. 打开R软件,安装包 scatterplot3d,演示需要用到此R包. 二.创建项目GraphGenerateByR,项目结构如下: 注意:这里需要引入RDotNet类库,可以自行下载:http://rdotnet.codeplex.com/ 三.Main窗体代码 using System; using System.Collections.Generic; using System.Comp
-
C# GDI在控件上绘图的方法
本文以在chart控件上和窗体上画矩形为例子讲述了C# GDI在控件上绘图的方法.分享给大家供大家参考.具体方法如下: 具体的实现方法就不多解释了,备注很详细,代码也很简单. 主要功能代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Te
-
C#打印绘图的实现方法
本文实例讲述了C#打印绘图的实现方法.分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: String drawString = ""; Font drawFont = null; SolidBrush drawBrush = null; float x = 0F; float y = 0F; StringFormat drawFormat = new StringFormat(); string test = ""; public string Tes
-
C#中GraphicsPath的Flatten方法用法实例
本文实例讲述了C#中GraphicsPath的Flatten方法.分享给大家供大家参考.具体实现方法如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D;
-
深入c# GDI+简单绘图的具体操作步骤(一)
最近对GDI+这个东西接触的比较多,也做了些简单的实例,比如绘图板,仿QQ截图等. 最早接触这个类,是因为想做仿QQ截图的效果.巧的很,学会了如何做截图后,.NET课堂上老师也正巧要讲关于c#绘图方面的知识,并且我自己又在网上学习金老师的培训班,也是要用到这个类.在学习中有一些体会,所以准备把这些体会记下来,因为内容比较多,可能我会分几次写.废话不多说了,我们先来认识一下这个GDI+,看看它到底长什么样.GDI+:Graphics Device Interface Plus也就是图形设备接口,提
-
混合语言编程—C#使用原生的Directx和OpenGL绘图的方法
由于项目需要做一些图形展示,所以就想到了使用Directx和OpenGL来绘图,但项目准备使用C#来开发(大家比较熟悉C#),在网上看了相关的资料,有一些第三方的控件可用,试用了下,一运行就占了几百M的内存,而且也不知道是否稳定,教程也少,还不如直接使用原生的.在网上看的Directx和OpenGL的教程基本上都是C/C++的,找了很久也就找到相关介绍,只能自己研究下. 我以前做过C#和C++混合语言编程相关的东西,在C++实现一些C#不好实现的功能,C#动态调用DLL文件,所以也想到了用C++
-
深入c# GDI+简单绘图的具体操作步骤(四)
前几篇我已经向大家介绍了如何使用GDI+来绘图,并做了一个截图的实例,这篇我向大家介绍下如何来做一个类似windows画图的工具.个人认为如果想做一个功能强大的绘图工具,那么单纯掌握GDI还远远不够,我的目前也只能做一个比较简单的绘图工具了.不足之处,欢迎大家讨论!先来看一下最终效果吧: 主要实现功能:画直线,矩形,橡皮,圆形,切换颜色,打开图片,保存图片,清除图片,手动调节画布大小;软件刚启动时,为一张空白画布,我们可以直接在画布上绘画,也可以通过菜单中的"打开",导入一张图片,然后
-
C#中GraphicsPath的Widen方法用法实例
本文实例讲述了C#中GraphicsPath的Widen方法用法.分享给大家供大家参考.具体如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; nam
-
C#实现动态数据绘图graphic的方法示例
本文实例讲述了C#实现动态数据绘图graphic的方法.分享给大家供大家参考,具体如下: 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; using System.Drawing.
-
C#中GraphicsPath的Warp方法用法实例
本文实例讲述了C#中GraphicsPath的Warp方法用法.分享给大家供大家参考.具体实现方法如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D;
-
深入c# GDI+简单绘图的具体操作步骤(三)
关于这个的例子其实网上已经有这方面的资料了,但是为了文章的完整性,还是觉得有必要讲解.我们先来看一下效果: (图(图1) ( 图2 )接下来看看这是如何做到的.
随机推荐
- 完全卸载mysql(停止服务、卸载相关程序、删除注册表
- vue2.0构建单页应用最佳实战
- Python列表和元组的定义与使用操作示例
- Android布局(RelativeLayout、TableLayout等)使用方法
- 四个常见html网页乱码问题及解决办法
- php采用ajax数据提交post与post常见方法总结
- Python中的异常处理相关语句基础学习笔记
- c++递归实现n皇后问题代码(八皇后问题)
- 关于MySQL innodb_autoinc_lock_mode介绍
- 谈谈impress.js初步理解
- PowerShell小技巧之尝试ssh登录
- 深入理解jQuery中live与bind方法的区别
- js操作数组函数实例小结
- C#实现判断操作系统是否为Win8以上版本
- 单例模式 分析代码优化方法
- PHP 模拟登陆MSN并获得用户信息
- java中申请不定长度数组ArrayList的方法
- ubuntu系统下Python虚拟环境的安装和使用教程
- Layer.js实现表格溢出内容省略号显示,悬停显示全部的方法
- layUI使用layer.open,在content打开数据表格,获取值并返回的方法
