AXForum  
Go Back   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Old 22.04.2011, 17:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,646 / 848 (80) +++++++
Join Date: 28.10.2006
equalized: Dynamics ax take screenshots from FormControls
Источник: http://blog.equalized.be/2010/11/dyn...-formcontrols/
==============

Hi all,

Here is a little code snippet for you to take screen shots within a Dynamics Ax client.

X++:
public void run(FormControl _control)
{
    str                         SaveToFileName;
    System.Drawing.Bitmap           bitmap;
    System.Drawing.Graphics        graphics;
    System.Windows.Forms.Screen primaryScreen;
    System.Drawing.Rectangle       bounds;
 
    int                                       x, y, k, l;
    System.Int32                         width;
    System.Int32                         height;
 
    #define.FileName('DynamicsAx_Screenshot.png')
    ;
 
    try
    {
        // 5 for the My Documents folder
        SaveToFileName  = strfmt(@"%1\%2",WinApi::getFolderPath(5),#FileName);
 
        primaryScreen   = System.Windows.Forms.Screen::get_PrimaryScreen();
        bounds          = primaryScreen.get_Bounds();
 
        [x, y, k, l]    = WinApi::getWindowRect(_control.hWnd());
 
        width           = _control.widthValue();
        height          = _control.heightValue();
 
        // TwC: used API CLRObject
        // BP Deviation Documented
        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
    {
        error("The file could not be saved"); // TODO make label
    }
}
This snippets uses the size of your control and the position on your screen to create the screenshot



Источник: http://blog.equalized.be/2010/11/dyn...-formcontrols/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Last edited by Poleax; 22.04.2011 at 17:27. Reason: код
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamics-ax: Interview with Microsoft's Lachlan Cash on his new role, AX 2012 and more Blog bot DAX Blogs 6 22.04.2011 14:55
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
dynamics-ax: Official Details about Dynamics AX '6' released, including comments from Microsofts Kees Hertogh Blog bot DAX Blogs 0 11.01.2011 05:22
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Рейтинг@Mail.ru
All times are GMT +3. The time now is 04:35.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Contacts E-mail, Advertising.