C#中GraphicsPath的AddString方法用法實(shí)例
更新時(shí)間:2015年06月12日 14:49:25 作者:zhuzhao
這篇文章主要介紹了C#中GraphicsPath的AddString方法用法,實(shí)例分析了AddString方法添加字符串的相關(guān)使用技巧,需要的朋友可以參考下
本文實(shí)例講述了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);
}
}
}
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:
- C#實(shí)現(xiàn)Windows Form調(diào)用R進(jìn)行繪圖與顯示的方法
- C#打印繪圖的實(shí)現(xiàn)方法
- C# GDI在控件上繪圖的方法
- 混合語(yǔ)言編程—C#使用原生的Directx和OpenGL繪圖的方法
- 深入c# GDI+簡(jiǎn)單繪圖的具體操作步驟(四)
- 深入c# GDI+簡(jiǎn)單繪圖的具體操作步驟(三)
- 深入c# GDI+簡(jiǎn)單繪圖的具體操作步驟(二)
- 深入c# GDI+簡(jiǎn)單繪圖的具體操作步驟(一)
- C#中GraphicsPath的Warp方法用法實(shí)例
- C#中GraphicsPath的Widen方法用法實(shí)例
- C#中GraphicsPath的Flatten方法用法實(shí)例
- C#實(shí)現(xiàn)動(dòng)態(tài)數(shù)據(jù)繪圖graphic的方法示例
相關(guān)文章
C#實(shí)現(xiàn)的xml操作類完整實(shí)例
這篇文章主要介紹了C#實(shí)現(xiàn)的xml操作類,包含C#針對(duì)xml的創(chuàng)建、刪除、遍歷、插入等常見操作,需要的朋友可以參考下2016-06-06
Unity實(shí)現(xiàn)老虎機(jī)滾動(dòng)抽獎(jiǎng)效果的示例代碼
這篇文章主要介紹了Unity實(shí)現(xiàn)老虎機(jī)滾動(dòng)抽獎(jiǎng)效果的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04
C#實(shí)現(xiàn)OFD格式與PDF格式的互轉(zhuǎn)
OFD格式的文檔是一種我國(guó)獨(dú)有的國(guó)家標(biāo)準(zhǔn)版式的文檔。本文將通過C#程序介紹如何實(shí)現(xiàn)由OFD與PDF的互相轉(zhuǎn)換,感興趣的小伙伴可以了解一下2022-02-02
C# WinForm調(diào)用net core實(shí)現(xiàn)文件上傳接口
這篇文章主要為大家詳細(xì)介紹了C# WinForm如何調(diào)用net core實(shí)現(xiàn)文件上傳接口,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2024-04-04

