C#中GraphicsPath的Warp方法用法實例
更新時間:2015年06月12日 14:44:57 作者:zhuzhao
這篇文章主要介紹了C#中GraphicsPath的Warp方法用法,實例分析了Warp方法的相關(guān)使用技巧,需要的朋友可以參考下
本文實例講述了C#中GraphicsPath的Warp方法用法。分享給大家供大家參考。具體實現(xiàn)方法如下:
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 Form13 : Form { public Form13() { InitializeComponent(); } private void Form13_Paint(object sender, PaintEventArgs e) { // Create a path and add a rectangle. GraphicsPath myPath = new GraphicsPath(); RectangleF srcRect = new RectangleF(0, 0, 100, 200); myPath.AddRectangle(srcRect); // Draw the source path (rectangle)to the screen. e.Graphics.DrawPath(Pens.Black, myPath); // Create a destination for the warped rectangle. PointF point1 = new PointF(200, 200); PointF point2 = new PointF(400, 250); PointF point3 = new PointF(220, 400); PointF[] destPoints = { point1, point2, point3 }; // Create a translation matrix. Matrix translateMatrix = new Matrix(); translateMatrix.Translate(100, 0); // Warp the source path (rectangle). myPath.Warp(destPoints, srcRect, translateMatrix, WarpMode.Perspective, 0.5f); // Draw the warped path (rectangle) to the screen. e.Graphics.DrawPath(new Pen(Color.Red), myPath); } } }
希望本文所述對大家的C#程序設(shè)計有所幫助。
您可能感興趣的文章:
- C#實現(xiàn)Windows Form調(diào)用R進行繪圖與顯示的方法
- C#打印繪圖的實現(xiàn)方法
- C# GDI在控件上繪圖的方法
- 混合語言編程—C#使用原生的Directx和OpenGL繪圖的方法
- 深入c# GDI+簡單繪圖的具體操作步驟(四)
- 深入c# GDI+簡單繪圖的具體操作步驟(三)
- 深入c# GDI+簡單繪圖的具體操作步驟(二)
- 深入c# GDI+簡單繪圖的具體操作步驟(一)
- C#中GraphicsPath的AddString方法用法實例
- C#中GraphicsPath的Widen方法用法實例
- C#中GraphicsPath的Flatten方法用法實例
- C#實現(xiàn)動態(tài)數(shù)據(jù)繪圖graphic的方法示例
相關(guān)文章
C# 實現(xiàn)PPT 每一頁轉(zhuǎn)成圖片過程解析
這篇文章主要介紹了C# 實現(xiàn)PPT 每一頁轉(zhuǎn)成圖片過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-09-09C#使用WebService結(jié)合jQuery實現(xiàn)無刷新翻頁的方法
這篇文章主要介紹了C#使用WebService結(jié)合jQuery實現(xiàn)無刷新翻頁的方法,涉及C#中WebService與jQuery操作的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-04-04深入Unix時間戳與C# DateTime時間類型互換的詳解
本篇文章是對Unix時間戳與C# DateTime時間類型互換進行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06C# / VB.NET 在PPT中創(chuàng)建、編輯PPT SmartArt圖形的方法詳解
本文介紹通過C#和VB.NET程序代碼來創(chuàng)建和編輯PPT文檔中的SmartArt圖形。文中將分兩個操作示例來演示創(chuàng)建和編輯結(jié)果,需要的朋友可以參考下2020-10-10