C#中GraphicsPath的AddString方法用法實例
更新時間:2015年06月12日 14:49:25 作者:zhuzhao
這篇文章主要介紹了C#中GraphicsPath的AddString方法用法,實例分析了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#實現(xiàn)Windows Form調用R進行繪圖與顯示的方法
- C#打印繪圖的實現(xiàn)方法
- C# GDI在控件上繪圖的方法
- 混合語言編程—C#使用原生的Directx和OpenGL繪圖的方法
- 深入c# GDI+簡單繪圖的具體操作步驟(四)
- 深入c# GDI+簡單繪圖的具體操作步驟(三)
- 深入c# GDI+簡單繪圖的具體操作步驟(二)
- 深入c# GDI+簡單繪圖的具體操作步驟(一)
- C#中GraphicsPath的Warp方法用法實例
- C#中GraphicsPath的Widen方法用法實例
- C#中GraphicsPath的Flatten方法用法實例
- C#實現(xiàn)動態(tài)數據繪圖graphic的方法示例
相關文章
C# WinForm調用net core實現(xiàn)文件上傳接口
這篇文章主要為大家詳細介紹了C# WinForm如何調用net core實現(xiàn)文件上傳接口,文中的示例代碼講解詳細,感興趣的小伙伴可以跟隨小編一起學習一下2024-04-04

