zoukankan      html  css  js  c++  java
  • Using .net Code saved full Screen Resolution Image in Dynamics AX 2009

     Using .net Code saved as full Screen Resolution Image in Dynamics AX 2009

    Wrote by Jimmy Feb 11th 2011

    static void Jimmy_ImagesSavedFullScreen(Args _args)
    {  
        System.Drawing.Bitmap           bitmap;  
        System.Drawing.Graphics         graphics;  
        System.Windows.Forms.Screen     primaryScreen;  
        System.Drawing.Rectangle        bounds;  
        int                             x, y, k, l;  
        str                             SaveToFileName;  
        System.Int32                    width;  
        System.Int32                    height;  
        filename                        filename;  
        System.Exception                ex;
        #WINAPI  
        #define.FileName('DynamicsAx_Screenshot.png')  
    ;  
        try
        {  
            SaveToFileName  = strfmt(@"%1\%2",WinApi::getFolderPath(0),#FileName);//0
            /*
            #define.CSIDL_DESKTOP                   (0x0000)        // <desktop>
            #define.CSIDL_INTERNET                  (0x0001)        // Internet Explorer (icon on desktop)
            #define.CSIDL_PROGRAMS                  (0x0002)        // Start Menu\Programs
            #define.CSIDL_CONTROLS                  (0x0003)        // My Computer\Control Panel
            #define.CSIDL_PRINTERS                  (0x0004)        // My Computer\Printers
            #define.CSIDL_PERSONAL                  (0x0005)        // My Documents
            */
            if(winapi::fileExists(SaveToFileName,false))  
                winapi::deleteFile(SaveToFileName);  
            primaryScreen   = System.Windows.Forms.Screen::get_PrimaryScreen();  
            bounds          = primaryScreen.get_Bounds();  
       
            [x, y, k, l]    = WinApi::getWindowRect(infolog.hWnd());  
       
            width       = WinAPI::getSystemMetrics(#SM_CXSCREEN);  
            height      = WinAPI::getSystemMetrics(#SM_CYSCREEN);  
       
            bitmap          = new System.Drawing.Bitmap(width,height);  
       
            graphics        = System.Drawing.Graphics::FromImage(bitmap);  
            graphics.CopyFromScreen(x,y,0,0,bitmap.get_Size());  
       
            bitmap.Save(SaveToFileName, System.Drawing.Imaging.ImageFormat::get_Png());
        }
        catch(Exception::CLRError)    
        {
            ex = CLRInterop::getLastException();
            while( ex )
            {
            info( ex.get_Message() );
            ex = ex.get_InnerException();
            }
        }
        catch(Exception::Error)
        {
            error("The file could not be saved");
            global::exceptionTextFallThrough();
        }
        if(winapi::fileExists(SaveToFileName,false))  
            winapi::shellExecute(SaveToFileName);  
       
    }
    
  • 相关阅读:
    linux配置PHP环境!!(云服务器架设)
    JQ上传预览+存数据库
    AJAX做增删改查详细!
    JS解析XML
    UEditor编辑器的使用
    php注释规范
    phpexcel导出数据表格
    简单分析JavaScript中的面向对象
    制作smarty模版缓存文件
    求二叉树中节点的最大距离
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1951114.html
Copyright © 2011-2022 走看看