zoukankan      html  css  js  c++  java
  • 打印图片

    先在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);
        }
    }
    

      

  • 相关阅读:
    C++中操作符函数
    C++中的类
    大型网站系统架构的演化
    GitHub初体验(小菜新手github用起来)
    黄聪:Adobe CS4 中文版 完美破解版下载
    WIN7下回收站不小心删除的文件怎么恢复,免费数据恢复软件下载
    PowerDesigner使用教程
    黄聪:CodeSmith和PowerDesigner的使用安装和数据库创建(原创系列教程)
    ORACLE SEQUENCE用法
    C++ DirectUI库收集
  • 原文地址:https://www.cnblogs.com/soundcode/p/8109944.html
Copyright © 2011-2022 走看看