打印图片
先在Assets工程 里Plugins配置文件夾 放一個System.Drawing.dll動態鏈接庫
/* ######### ############ ############# ## ########### ### ###### ##### ### ####### #### ### ########## #### #### ########### #### #### ########### ##### ##### ### ######## ##### ##### ### ######## ###### ###### ### ########### ###### ###### #### ############## ###### ####### ##################### ###### ####### ###################### ###### ####### ###### ################# ###### ####### ###### ###### ######### ###### ####### ## ###### ###### ###### ####### ###### ##### ##### ###### ##### ##### #### ##### #### ##### ### ##### ### ### # ### ### ### ## ### ### __________#_______####_______####______________身是菩提樹,心如明鏡臺,時時勤拂拭,勿使惹塵埃。我們的未來沒有BUG * ============================================================================== * Filename: Instering * Created: 2017/8/1 * Author: WYC * Purpose: 打印圖片 * ============================================================================== */ using UnityEngine; using System.Drawing.Printing; using System;public class DrawingTest : MonoBehaviour {private static string path = "D://UnityProgram/kinect1/Assets/AdamBieber/1.jpg";private static int ImageCapX = 0; private static int ImageCapY = 0;private static int ImageWidth = 520;private static int ImageHight = 1314;/// <summary>/// 打印圖片/// </summary>private void btnPrint_Click(){//打印預覽PrintDocument pd = new PrintDocument();//打印事件設置pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);try{pd.Print();}catch (Exception ex){Debug.LogError(ex.Message);}}private void pd_PrintPage(object sender, PrintPageEventArgs e){System.Drawing.Image image = System.Drawing.Image.FromFile(path);e.Graphics.DrawImage(image, ImageCapX, ImageCapY, ImageWidth, ImageHight);} }總結
- 上一篇: 正能量是什么意思网络语言(正能量是什么意
- 下一篇: 山东航母上的人都是军人吗?