Показать сообщение отдельно
Старый 03.03.2009, 03:08   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Creating an image file based on plain text from AX
Источник: http://palleagermark.blogspot.com/20...lain-text.html
==============

For the new version of Logica's electronic invoice handling module (eScan) I needed to create a tiff image file from plain text.

Here is a short example on how you can do that through CLR from X++:

X++:
static void createTiffFromText(Args _args)
{
    FileName                  outputFileName = @'C:\Test\MyNewImage.tiff';
    str                       sampleText = "My sample text...";
    System.Drawing.Bitmap     bitmap;
    System.Drawing.Graphics   graphics;
    ;


    bitmap = new System.Drawing.Bitmap(220, 50);
    graphics = System.Drawing.Graphics::FromImage(bitmap);




    graphics.FillRectangle(System.Drawing.Brushes::get_Yellow(), 0, 0, 220, 50);


    graphics.DrawString(sampleText,
                        new System.Drawing.Font("Verdana", 18),
                        new System.Drawing.SolidBrush(System.Drawing.Color::get_Black()), 0 ,0);


    bitmap.Save(outputFileName, System.Drawing.Imaging.ImageFormat::get_Tiff());


    // Show the image
    Winapi::shellExecute(outputFileName);
}



Источник: http://palleagermark.blogspot.com/20...lain-text.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.