Пример #1
0
 public void OnGetNewText(IPXC_ContentCreator pCC, out string ppText, out int pTextLen, out uint pFlags)
 {
     ppText   = m_Text;
     pTextLen = -1;
     pFlags   = 0;
     m_Text   = "";
 }
Пример #2
0
        static public int ConvertToPDF(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }

            IIXC_Inst  ixcInst = Parent.m_pxcInst.GetExtension("IXC");
            IAUX_Inst  auxInst = Parent.m_pxcInst.GetExtension("AUX");
            IPXC_Pages pages   = Parent.m_CurDoc.Pages;
            IPXC_Page  Page    = pages[0];
            double     nHeight = 0.0;
            double     nWidth  = 0.0;

            Page.GetDimension(out nWidth, out nHeight);
            IIXC_Image img = ixcInst.CreateEmptyImage();

            img.Load(System.Environment.CurrentDirectory + "\\Images\\Editor_welcome.png");
            IIXC_Page           ixcPage = img.GetPage(0);
            IPXC_Image          pxcImg  = Parent.m_CurDoc.AddImageFromIXCPage(ixcPage);
            IPXC_ContentCreator CC      = Parent.m_CurDoc.CreateContentCreator();
            PXC_Rect            rcImg   = new PXC_Rect();

            CC.SaveState();
            {
                //Proportional resize rectangle calculation
                {
                    double k1 = nWidth / nHeight;
                    double k2 = (double)pxcImg.Width / pxcImg.Height;
                    if (k1 >= k2)
                    {
                        rcImg.top   = nHeight;
                        rcImg.right = nWidth / 2.0 + rcImg.top * k2 / 2.0;
                        rcImg.left  = nWidth / 2.0 - rcImg.top * k2 / 2.0;
                    }
                    else
                    {
                        rcImg.right  = nWidth;
                        rcImg.top    = nHeight / 2.0 + rcImg.right / k2 / 2.0;
                        rcImg.bottom = nHeight / 2.0 - rcImg.right / k2 / 2.0;
                    }
                }
                //Moving the image rectangle to the center

                PXC_Rect rcImage = new PXC_Rect();
                rcImage.right = 1;
                rcImage.top   = 1;
                PXC_Matrix matrix = Page.GetMatrix(PXC_BoxType.PBox_PageBox);
                matrix = auxInst.MathHelper.Matrix_RectToRect(ref rcImage, ref rcImg);
                CC.ConcatCS(ref matrix);
                CC.PlaceImage(pxcImg);
            }
            CC.RestoreState();
            Page.PlaceContent(CC.Detach());

            Marshal.ReleaseComObject(Page);
            Marshal.ReleaseComObject(pages);

            return((int)Form1.eFormUpdateFlags.efuf_All);
        }
Пример #3
0
        static public void AddTextToThePageCenter(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }
            IPXC_Pages          pages  = Parent.m_CurDoc.Pages;
            IPXC_Page           page   = pages[0];
            PXC_Rect            rcPage = page.get_Box(PXC_BoxType.PBox_PageBox);
            IPXC_ContentCreator CC     = Parent.m_CurDoc.CreateContentCreator();
            IPXC_Font           font   = Parent.m_CurDoc.CreateNewFont("Tahoma", 0, 400);

            CC.SaveState();
            CC.SetFont(font);
            CC.SetStrokeColorRGB(0x000000);
            CC.SetFontSize(36);
            string   str   = "Centered Text";
            PXC_Rect rcOut = new PXC_Rect();

            //Calculating the text rectangle
            CC.ShowTextBlock(str, ref rcPage, ref rcPage, (uint)PXC_DrawTextFlags.DTF_CalcSizeOnly, -1, null, null, null, out rcOut);
            //Placing it in the center of page
            double nCX = (rcPage.right - rcPage.left) / 2.0;
            double nCY = (rcPage.top - rcPage.bottom) / 2.0;
            double nW  = rcOut.right - rcOut.left;
            double nH  = rcOut.top - rcOut.bottom;

            rcOut.left   = nCX - nW / 2.0;
            rcOut.bottom = nCY - nH / 2.0;
            rcOut.right  = rcOut.left + nW;
            rcOut.top    = rcOut.bottom + nH;
            //Outputting the text
            PXC_Rect rc = new PXC_Rect();

            CC.ShowTextBlock(str, ref rcOut, ref rcOut, 0, -1, null, null, null, out rc);
            CC.RestoreState();
            page.PlaceContent(CC.Detach());
            Marshal.ReleaseComObject(page);
            Marshal.ReleaseComObject(pages);
        }
Пример #4
0
        static public int ConvertFromTXT(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }
            IPXC_Pages pages     = Parent.m_CurDoc.Pages;
            IPXC_Page  firstPage = pages[0];
            PXC_Rect   rc        = firstPage.get_Box(PXC_BoxType.PBox_PageBox);

            Marshal.ReleaseComObject(firstPage);
            IPXC_UndoRedoData   urData;
            IPXC_ContentCreator CC   = Parent.m_CurDoc.CreateContentCreator();
            IPXC_Page           page = pages.InsertPage(0, ref rc, out urData);
            DrawTextCallbacks   drawTextCallbacks = new DrawTextCallbacks();

            drawTextCallbacks.m_currPage = page;

            drawTextCallbacks.m_Text = File.ReadAllText(Environment.CurrentDirectory + "\\Documents\\Hobbit.txt");

            IPXC_Font font = Parent.m_CurDoc.CreateNewFont("Times New Roman", 0, 400);

            CC.SetColorRGB(0x00000000);
            CC.SetFont(font);
            CC.SetFontSize(15);

            PXC_Rect rect = new PXC_Rect();

            rect.top    = rc.top - 40;
            rect.right  = rc.right - 40;
            rect.bottom = rc.bottom + 40;
            rect.left   = rc.left + 40;

            CC.ShowTextBlock(drawTextCallbacks.m_Text, rect, rect, (uint)PXC_DrawTextFlags.DTF_Center, -1, null, null, drawTextCallbacks, out rect);
            Marshal.ReleaseComObject(page);
            Marshal.ReleaseComObject(pages);

            return((int)Form1.eFormUpdateFlags.efuf_All);
        }
Пример #5
0
            public void OnGetNewRect(IPXC_ContentCreator pCC, out PXC_Rect pRect, ref uint pFlags, out PXC_Rect pClip)
            {
                m_currPage.PlaceContent(pCC.Detach(), (uint)PXC_PlaceContentFlags.PlaceContent_Replace);
                PXC_Rect          rc = m_currPage.get_Box(PXC_BoxType.PBox_PageBox);
                IPXC_UndoRedoData urData;

                m_currPage.Document.CreateContentCreator();
                IPXC_Pages pages = m_currPage.Document.Pages;
                IPXC_Page  page  = pages.InsertPage(m_currPage.Number + 1, ref rc, out urData);

                Marshal.ReleaseComObject(m_currPage);
                m_currPage = page;

                PXC_Rect rect = new PXC_Rect();

                rect.top    = rc.top - 40;
                rect.right  = rc.right - 40;
                rect.bottom = rc.bottom + 40;
                rect.left   = rc.left + 40;

                pRect = rect;
                pClip = rect;
                Marshal.ReleaseComObject(pages);
            }
Пример #6
0
        private static void Draw_Keys_Horisontal(ref IPXC_ContentCreator CC, ref IPXC_Page page)
        {
            int Rect_size_for_20 = (page_Width) / (20 + 2);
            height = workspace_ob.field_ex.heigth;
            width = workspace_ob.field_ex.width;
            keys_count = workspace_ob.keys.Count;
            PXC_Rect rc = new PXC_Rect();
            PXC_Rect rc_out = new PXC_Rect();
            CC.SetLineWidth(0.5);//Set line  width

            string str_keys = "Keys:\n";

            // Define the coordinates for rect
            rc.top = page_Height - (2 * Rect_size) - Rect_size_for_20 + 60;
            rc.bottom = page_Height - (2 * Rect_size) - 60;
            rc.left = x_field_bottom + Rect_size_for_20;
            rc.right = x_field_bottom + Rect_size_for_20 * 6;

            IPXC_CharFormat char_format = inst_pxc.CreateCharFormat();
            char_format.FontSize = 20;
            char_format.ModifyMask((uint)PXC_CharFormatMask.CFM_FontSize, 0);

            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(str_keys, ref rc, ref rc,
                (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter | (uint)PXC_DrawTextFlags.DTF_Justify,
                (int)-1, char_format, null, null, out rc_out);

            // Define the coordinates for rect
            rc.top = page_Height - Rect_size_for_20 * 2 + 90;
            rc.bottom = page_Height - Rect_size_for_20;
            rc.left = Rect_size_for_20;
            rc.right = page_Width - Rect_size_for_20;

            string template_info = Get_Template_String();
            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(template_info, ref rc, ref rc,
                (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter
                | (uint)PXC_DrawTextFlags.DTF_Justify, (int)-1, char_format, null, null, out rc_out);

            for (int i = 1, key_counter = 0; i <= keys_count && key_counter < keys_count; i++, key_counter++)
            {
                int key_rect_top = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20 + Rect_size_for_20);
                int key_rect_bottom = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20);
                int key_rect_right = page_Width - Rect_size_for_20;
                int key_rect_left = Rect_size_for_20;
                Color current_key_color = workspace_ob.keys[key_counter].clr;
                string string_in_key_field = workspace_ob.clr_name[key_counter];
                string current_key_text = workspace_ob.keys[key_counter].str;

                // Define the coordinates for rect
                rc.top = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * (i + 1)) + Rect_size_for_20 / 2;
                rc.bottom = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * i) + Rect_size_for_20 / 2;
                rc.left = x_field_bottom + Rect_size_for_20;
                rc.right = x_field_bottom + Rect_size_for_20 * 4;

                DrawColoringRect(ref CC, ref rc, Color.White);

                // Define the coordinates for rect
                rc.top = rc.top + 30;
                rc.bottom = rc.bottom - 30;

                CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

                //Draw text block with current text in rc coordinates
                CC.ShowTextBlock(current_key_text, ref rc, ref rc,
                    (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                double old_left = rc.left;

                // Define the coordinates for rect
                rc.top = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * (i + 1)) + Rect_size_for_20 / 2;
                rc.bottom = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * i) + Rect_size_for_20 / 2;
                rc.left = rc.right + 10;
                rc.right = rc.right + (rc.right - old_left) + 10;

                DrawColoringRect(ref CC, ref rc, current_key_color);

                rc.top = rc.top + 30;
                rc.bottom = rc.bottom - 30;

                if (!isDarkColor(string_in_key_field))
                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling 
                else
                    CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling 

                CC.ShowTextBlock(string_in_key_field, ref rc, ref rc,
                    (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                page.PlaceContent(CC.Detach());//Appends drawn content to current page
                CC.SetLineWidth(0.5);//Set line  width
                CC.StrokePath(true);//Set end of drawing current element
            }
        }
Пример #7
0
 private static void DrawColoringRect(ref IPXC_ContentCreator CC, ref PXC_Rect rc, Color current_key_color)
 {
     CC.Rect(rc.left, rc.bottom, rc.right, rc.top);//Draw rectangle by current coordinates
     CC.SetFillColorRGB(Get_UINT_Color(current_key_color));//Set color of filling
     CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);//Filling current element
 }
Пример #8
0
        //Method for drawing Keys in verrtical mode
        private static void Draw_Keys_Vartical(ref IPXC_ContentCreator CC, ref IPXC_Page page)
        {
            // Create new PXC_Rect instances
            PXC_Rect rc     = new PXC_Rect();
            PXC_Rect rc_out = new PXC_Rect();

            int Rect_size_for_20 = page_Width / 22;

            height     = workspace_ob.field_ex.heigth;
            width      = workspace_ob.field_ex.width;
            keys_count = workspace_ob.keys.Count;
            Colomn_number key_colomn_number = Colomn_number.FIRST;

            CC.SetLineWidth(0.5);//Set line  width

            string str_keys = "Keys:\n";

            // Define the coordinates for rect
            rc.top    = y_field_bottom - Rect_size_for_20 + Rect_size_for_20;
            rc.bottom = y_field_bottom - Rect_size_for_20 * 6;
            rc.left   = Rect_size_for_20;
            rc.right  = Rect_size_for_20 * 3;

            //Create IPXC_CharFormat to modify font size
            IPXC_CharFormat char_format = inst_pxc.CreateCharFormat();

            char_format.FontSize = 20;
            char_format.ModifyMask((uint)PXC_CharFormatMask.CFM_FontSize, 0);

            //Creation text block for keys text
            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(str_keys, ref rc, ref rc,
                             (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter | (uint)PXC_DrawTextFlags.DTF_Justify,
                             (int)-1, char_format, null, null, out rc_out);


            // Define the coordinates for Template text block
            rc.top    = page_Height - Rect_size_for_20 * 2 + 50;
            rc.bottom = page_Height - Rect_size_for_20 - 30;
            rc.left   = Rect_size_for_20;
            rc.right  = page_Width - Rect_size_for_20;

            //Showing text block with Template name
            string template_info = Get_Template_String();

            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(template_info, ref rc, ref rc,
                             (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter
                             | (uint)PXC_DrawTextFlags.DTF_Justify, (int)-1, char_format, null, null, out rc_out);

            for (int i = 1, key_counter = 0; i <= keys_count && key_counter < keys_count; i++, key_counter++)
            {
                int    key_rect_top        = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20 + Rect_size_for_20);
                int    key_rect_bottom     = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20);
                int    key_rect_right      = page_Width - Rect_size_for_20;
                int    key_rect_left       = Rect_size_for_20;
                Color  current_key_color   = workspace_ob.keys[key_counter].clr;
                string string_in_key_field = workspace_ob.clr_name[key_counter];

                string current_key_text = workspace_ob.keys[key_counter].str;

                // Define the coordinates for rect
                rc.top    = key_rect_top;
                rc.bottom = key_rect_bottom;
                rc.left   = key_rect_left;
                rc.right  = key_rect_right / 4;

                if (key_colomn_number == Colomn_number.FIRST && rc.top >= Rect_size)
                {
                    DrawColoringRect(ref CC, ref rc, Color.White);

                    // Define the coordinates for rect
                    rc.top    = key_rect_top + 30;
                    rc.bottom = key_rect_bottom - 30;

                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black)); //Set color of filling

                    //Draw text block with current text in rc coordinates
                    CC.ShowTextBlock(current_key_text, ref rc, ref rc,
                                     (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                    rc.top    = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left   = key_rect_right / 4;
                    rc.right  = key_rect_right / 2 - 2;

                    CC.Rect(rc.left, rc.bottom, rc.right, rc.top);          //Draw rectangle by current coordinates
                    CC.SetFillColorRGB(Get_UINT_Color(current_key_color));  //Set color of filling
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd); //Filling current element

                    rc.top    = key_rect_top + 50;
                    rc.bottom = key_rect_bottom - 50;
                    rc.left   = key_rect_right / 4;
                    rc.right  = key_rect_right / 2 - 2;

                    if (!isDarkColor(string_in_key_field))
                    {
                        CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling
                    }
                    else
                    {
                        CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling
                    }
                    CC.ShowTextBlock(string_in_key_field, ref rc, ref rc,
                                     (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);
                }

                else
                {
                    if (key_colomn_number == Colomn_number.FIRST)
                    {
                        key_colomn_number = Colomn_number.SECOND;
                        i = 1;
                    }

                    key_rect_top    = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20 + Rect_size_for_20);
                    key_rect_bottom = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20);
                    key_rect_right  = page_Width - Rect_size_for_20 - 6;
                    key_rect_left   = key_rect_right / 2;

                    // Define the coordinates for rect
                    rc.top    = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left   = key_rect_left + 10;
                    rc.right  = key_rect_left + (key_rect_right - key_rect_left) / 2;

                    CC.Rect(rc.left, rc.bottom, rc.right, rc.top);          //Draw rectangle by current coordinates
                    CC.SetFillColorRGB(Get_UINT_Color(Color.White));        //Set color of filling
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd); //Filling current element

                    // Define the coordinates for rect
                    rc.top    = key_rect_top + 30;
                    rc.bottom = key_rect_bottom - 30;

                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

                    //Draw text block with current text in rc coordinates
                    CC.ShowTextBlock(current_key_text, ref rc, ref rc,
                                     (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                    rc.top    = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left   = rc.right;
                    rc.right  = key_rect_left + (key_rect_right - key_rect_left);

                    CC.Rect(rc.left, rc.bottom, rc.right, rc.top);          //Draw rectangle by current coordinates
                    CC.SetFillColorRGB(Get_UINT_Color(current_key_color));  //Set color of filling
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd); //Filling current element

                    rc.top    = key_rect_top + 30;
                    rc.bottom = key_rect_bottom - 30;

                    rc.right = key_rect_right;

                    if (!isDarkColor(string_in_key_field))
                    {
                        CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling
                    }
                    else
                    {
                        CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling
                    }
                    CC.ShowTextBlock(string_in_key_field, ref rc, ref rc,
                                     (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);
                }
                page.PlaceContent(CC.Detach()); //Appends drawn content to current page
                CC.SetLineWidth(0.5);           //Set line  width
                CC.StrokePath(true);            //Set end of drawing current element
            }
        }
Пример #9
0
        private static void Draw_Keys_Horisontal(ref IPXC_ContentCreator CC, ref IPXC_Page page)
        {
            int Rect_size_for_20 = (page_Width) / (20 + 2);

            height     = workspace_ob.field_ex.heigth;
            width      = workspace_ob.field_ex.width;
            keys_count = workspace_ob.keys.Count;
            PXC_Rect rc     = new PXC_Rect();
            PXC_Rect rc_out = new PXC_Rect();

            CC.SetLineWidth(0.5);//Set line  width

            string str_keys = "Keys:\n";

            // Define the coordinates for rect
            rc.top    = page_Height - (2 * Rect_size) - Rect_size_for_20 + 60;
            rc.bottom = page_Height - (2 * Rect_size) - 60;
            rc.left   = x_field_bottom + Rect_size_for_20;
            rc.right  = x_field_bottom + Rect_size_for_20 * 6;

            IPXC_CharFormat char_format = inst_pxc.CreateCharFormat();

            char_format.FontSize = 20;
            char_format.ModifyMask((uint)PXC_CharFormatMask.CFM_FontSize, 0);

            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(str_keys, ref rc, ref rc,
                             (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter | (uint)PXC_DrawTextFlags.DTF_Justify,
                             (int)-1, char_format, null, null, out rc_out);

            // Define the coordinates for rect
            rc.top    = page_Height - Rect_size_for_20 * 2 + 90;
            rc.bottom = page_Height - Rect_size_for_20;
            rc.left   = Rect_size_for_20;
            rc.right  = page_Width - Rect_size_for_20;

            string template_info = Get_Template_String();

            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(template_info, ref rc, ref rc,
                             (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter
                             | (uint)PXC_DrawTextFlags.DTF_Justify, (int)-1, char_format, null, null, out rc_out);

            for (int i = 1, key_counter = 0; i <= keys_count && key_counter < keys_count; i++, key_counter++)
            {
                int    key_rect_top        = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20 + Rect_size_for_20);
                int    key_rect_bottom     = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20);
                int    key_rect_right      = page_Width - Rect_size_for_20;
                int    key_rect_left       = Rect_size_for_20;
                Color  current_key_color   = workspace_ob.keys[key_counter].clr;
                string string_in_key_field = workspace_ob.clr_name[key_counter];
                string current_key_text    = workspace_ob.keys[key_counter].str;

                // Define the coordinates for rect
                rc.top    = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * (i + 1)) + Rect_size_for_20 / 2;
                rc.bottom = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * i) + Rect_size_for_20 / 2;
                rc.left   = x_field_bottom + Rect_size_for_20;
                rc.right  = x_field_bottom + Rect_size_for_20 * 4;

                DrawColoringRect(ref CC, ref rc, Color.White);

                // Define the coordinates for rect
                rc.top    = rc.top + 30;
                rc.bottom = rc.bottom - 30;

                CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

                //Draw text block with current text in rc coordinates
                CC.ShowTextBlock(current_key_text, ref rc, ref rc,
                                 (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                double old_left = rc.left;

                // Define the coordinates for rect
                rc.top    = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * (i + 1)) + Rect_size_for_20 / 2;
                rc.bottom = page_Height - (3 * Rect_size) - ((Rect_size_for_20 / 2) * i) + Rect_size_for_20 / 2;
                rc.left   = rc.right + 10;
                rc.right  = rc.right + (rc.right - old_left) + 10;

                DrawColoringRect(ref CC, ref rc, current_key_color);

                rc.top    = rc.top + 30;
                rc.bottom = rc.bottom - 30;

                if (!isDarkColor(string_in_key_field))
                {
                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling
                }
                else
                {
                    CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling
                }
                CC.ShowTextBlock(string_in_key_field, ref rc, ref rc,
                                 (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                page.PlaceContent(CC.Detach()); //Appends drawn content to current page
                CC.SetLineWidth(0.5);           //Set line  width
                CC.StrokePath(true);            //Set end of drawing current element
            }
        }
Пример #10
0
 private static void DrawColoringRect(ref IPXC_ContentCreator CC, ref PXC_Rect rc, Color current_key_color)
 {
     CC.Rect(rc.left, rc.bottom, rc.right, rc.top);          //Draw rectangle by current coordinates
     CC.SetFillColorRGB(Get_UINT_Color(current_key_color));  //Set color of filling
     CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd); //Filling current element
 }
        static public int AddRedactAnnotation(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }

            IPXC_UndoRedoData urData    = null;
            IPXC_Pages        pages     = Parent.m_CurDoc.Pages;
            IPXC_Page         firstPage = pages[0];
            PXC_Rect          rcPage    = firstPage.get_Box(PXC_BoxType.PBox_PageBox);

            Marshal.ReleaseComObject(firstPage);
            IPXC_Page           page    = pages.InsertPage(0, ref rcPage, out urData);
            IPXS_Inst           pxsInst = Parent.m_pxcInst.GetExtension("PXS");
            IAUX_Inst           auxInst = Parent.m_pxcInst.GetExtension("AUX");
            IPXC_ContentCreator CC      = Parent.m_CurDoc.CreateContentCreator();
            double nCX = (rcPage.right - rcPage.left) / 2.0;
            double nCY = (rcPage.top - rcPage.bottom) / 4.0 * 3.0;

            IPXC_Font font = Parent.m_CurDoc.CreateNewFont("Arial", (uint)PXC_CreateFontFlags.CreateFont_Monospaced, 700);

            CC.SetFontSize(30);
            CC.SetFont(font);
            CC.SetColorRGB(0x00000000);
            for (int i = 0; i < 4; i++)
            {
                CC.ShowTextLine(nCX - 190, nCY - (40 * i), "This is a story of long ago.", -1, (uint)PXC_ShowTextLineFlags.STLF_Default | (uint)PXC_ShowTextLineFlags.STLF_AllowSubstitution);
            }
            page.PlaceContent(CC.Detach(), (uint)PXC_PlaceContentFlags.PlaceContent_Replace);
            IPXC_PageText Text = page.GetText(null, false);

            PXC_Rect rcOut = new PXC_Rect();

            rcOut.left   = nCX - 150;
            rcOut.bottom = nCY - 100;
            rcOut.right  = nCX + 150;
            rcOut.top    = nCY + 100;
            //Getting Redact annotation atom for the InsertNewAnnot method
            uint                     nText = pxsInst.StrToAtom("Redact");
            IPXC_Annotation          annot = unchecked (page.InsertNewAnnot(nText, ref rcOut));
            IPXC_AnnotData_Redaction aData = annot.Data as IPXC_AnnotData_Redaction;

            aData.Title = "Redact annotation 1.";

            IPXC_QuadsF quadsF = Parent.m_pxcInst.CreateQuads();
            uint        afafaf = quadsF.Count;
            PXC_RectF   rectF  = new PXC_RectF();

            Text.GetTextQuads3(8, 75, quadsF, out rectF);
            aData.Quads = quadsF;
            var color = auxInst.CreateColor(ColorType.ColorType_RGB);

            color.SetRGB(0.0f, 0.0f, 0.0f);
            aData.FColor = color;
            aData.SColor = color;
            annot.Data   = aData;

            Marshal.ReleaseComObject(page);
            Marshal.ReleaseComObject(pages);

            return((int)Form1.eFormUpdateFlags.efuf_Annotations);
        }
Пример #12
0
        static public void AddButtonWithIconAndURI(Form1 Parent)
        {
            int index = 1;
            //delegate string CheckNamesFields(IPXC_Document Doc, string fieldName, ref int x);
            CheckNamesFields checkNamesFields = (IPXC_Document Doc, string fName, ref int inx) =>
            {
                string sFieldName = "";
                uint   i          = 0;
                do
                {
                    sFieldName = fName + inx;
                    IPXC_FormField ff = Doc.AcroForm.GetFieldByName(sFieldName);
                    if (ff == null)
                    {
                        break;
                    }
                    inx++;
                    i++;
                }while (i <= Doc.AcroForm.FieldsCount);
                inx++;
                return(sFieldName);
            };

            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }

            PXC_Rect rc = new PXC_Rect();

            rc.top   = 800;
            rc.right = 600;

            //Adding button with icon with the URI action
            IPXC_UndoRedoData urD   = null;
            IPXC_Pages        pages = Parent.m_CurDoc.Pages;
            IPXC_Page         Page  = pages.InsertPage(0, rc, out urD);
            PXC_Rect          rcPB  = new PXC_Rect();

            rcPB.left   = 1.5 * 72.0;
            rcPB.right  = rcPB.left + 0.5 * 72.0;
            rcPB.top    = rc.top - 0.14 * 72.0;
            rcPB.bottom = rcPB.top - 0.5 * 72.0;             //top is greater then bottom (PDF Coordinate System)
            IPXC_FormField googleButton = Parent.m_CurDoc.AcroForm.CreateField(checkNamesFields(Parent.m_CurDoc, "Button", ref index), PXC_FormFieldType.FFT_PushButton, 0, ref rcPB);
            //Now we'll need to add the icon
            IPXC_Annotation       annot = googleButton.Widget[0];
            IPXC_AnnotData_Widget WData = (IPXC_AnnotData_Widget)annot.Data;
            string              sPath   = System.Environment.CurrentDirectory + "\\Images\\gotoSource_24.png";
            IPXC_Image          img     = Parent.m_CurDoc.AddImageFromFile(sPath);
            float               imgw    = img.Width;
            float               imgh    = img.Height;
            IPXC_ContentCreator CC      = Parent.m_CurDoc.CreateContentCreator();

            CC.SaveState();
            CC.ScaleCS(imgw, imgh);             //the image will be scaled to the button's size
            CC.PlaceImage(img);
            CC.RestoreState();
            IPXC_Content content = CC.Detach();
            PXC_Rect     rcBBox;

            rcBBox.left   = 0;
            rcBBox.top    = imgh;
            rcBBox.right  = imgw;
            rcBBox.bottom = 0;
            content.set_BBox(rcBBox);
            IPXC_XForm xForm = Parent.m_CurDoc.CreateNewXForm(ref rcPB);

            xForm.SetContent(content);
            WData.ButtonTextPosition = PXC_WidgetButtonTextPosition.WidgetText_IconOnly;
            WData.SetIcon(PXC_AnnotAppType.AAT_Normal, xForm, true);
            WData.Contents = "http://www.google.com";             //tooltip
            annot.Data     = WData;
            //Setting the annotation's URI action
            IPXC_ActionsList AL = Parent.m_CurDoc.CreateActionsList();

            AL.AddURI("https://www.google.com");
            annot.set_Actions(PXC_TriggerType.Trigger_Up, AL);
            Marshal.ReleaseComObject(googleButton);


            //Adding button with icon and label and JS that goes to next page
            rcPB.left += 1.2 * 72.0;
            rcPB.right = rcPB.left + 0.6 * 72.0;
            IPXC_FormField nextButton = Parent.m_CurDoc.AcroForm.CreateField(checkNamesFields(Parent.m_CurDoc, "Button", ref index), PXC_FormFieldType.FFT_PushButton, 0, ref rcPB);

            //Now we'll need to add the icon
            annot = nextButton.Widget[0];
            WData = (IPXC_AnnotData_Widget)annot.Data;
            sPath = System.Environment.CurrentDirectory + "\\Images\\next_24.png";
            img   = Parent.m_CurDoc.AddImageFromFile(sPath);
            imgw  = img.Width;
            imgh  = img.Height;
            CC.SaveState();
            CC.ScaleCS(imgw, imgh);             //the image will be scaled to the button's size
            CC.PlaceImage(img);
            CC.RestoreState();
            content       = CC.Detach();
            rcBBox.left   = 0;
            rcBBox.top    = imgh;
            rcBBox.right  = imgw;
            rcBBox.bottom = 0;
            content.set_BBox(rcBBox);
            xForm = Parent.m_CurDoc.CreateNewXForm(ref rcPB);
            xForm.SetContent(content);
            WData.SetCaption(PXC_AnnotAppType.AAT_Normal, "Next Page");
            WData.ButtonTextPosition = PXC_WidgetButtonTextPosition.WidgetText_IconTextV;
            PXC_Point p = new PXC_Point();

            p.x = 0.5;
            p.y = 0.5;
            WData.set_IconOffset(p);
            WData.SetIcon(PXC_AnnotAppType.AAT_Normal, xForm, true);
            WData.Contents = "Next Page";             //tooltip
            annot.Data     = WData;
            //Setting the annotation's Goto action
            PXC_Destination dest = new PXC_Destination();

            dest.nPageNum   = Page.Number + 1;
            dest.nType      = PXC_DestType.Dest_XYZ;
            dest.nNullFlags = 15;
            AL = Parent.m_CurDoc.CreateActionsList();
            AL.AddGoto(dest);
            annot.set_Actions(PXC_TriggerType.Trigger_Up, AL);
            Marshal.ReleaseComObject(nextButton);

            //Adding text button that opens the file
            rcPB.left += 1.5 * 72.0;
            rcPB.right = rcPB.left + 2.0 * 72.0;
            IPXC_FormField openButton = Parent.m_CurDoc.AcroForm.CreateField(checkNamesFields(Parent.m_CurDoc, "Button", ref index), PXC_FormFieldType.FFT_PushButton, 0, ref rcPB);

            //Now we'll need to add the icon
            annot = openButton.Widget[0];
            WData = (IPXC_AnnotData_Widget)annot.Data;
            WData.ButtonTextPosition = PXC_WidgetButtonTextPosition.WidgetText_TextOnly;
            WData.SetCaption(PXC_AnnotAppType.AAT_Normal, "Open File");
            WData.Contents = "Open File";             //tooltip
            annot.Data     = WData;
            //Setting the annotation's Launch action
            AL    = Parent.m_CurDoc.CreateActionsList();
            sPath = System.Environment.CurrentDirectory + "\\Documents\\FeatureChartEU.pdf";
            AL.AddLaunch(sPath);
            annot.set_Actions(PXC_TriggerType.Trigger_Up, AL);
            Marshal.ReleaseComObject(openButton);
            Marshal.ReleaseComObject(Page);
            Marshal.ReleaseComObject(pages);
        }
Пример #13
0
 public void OnFinal(IPXC_ContentCreator CC)
 {
     m_currPage.PlaceContent(CC.Detach(), (uint)PXC_PlaceContentFlags.PlaceContent_Replace);
     Marshal.ReleaseComObject(m_currPage);
 }
Пример #14
0
 public void OnEndPara(IPXC_ContentCreator pCC, int nIndex, string pID, string pText, int nTextLen, IPXC_Rects pLines)
 {
 }
Пример #15
0
        //Method for drawing Keys in verrtical mode
        private static void Draw_Keys_Vartical(ref IPXC_ContentCreator CC, ref IPXC_Page page)
        {
            // Create new PXC_Rect instances
            PXC_Rect rc = new PXC_Rect();
            PXC_Rect rc_out = new PXC_Rect();

            int Rect_size_for_20 = page_Width / 22;
            height = workspace_ob.field_ex.heigth;
            width = workspace_ob.field_ex.width;
            keys_count = workspace_ob.keys.Count;
            Colomn_number key_colomn_number = Colomn_number.FIRST;

            CC.SetLineWidth(0.5);//Set line  width

            string str_keys = "Keys:\n";

            // Define the coordinates for rect
            rc.top = y_field_bottom - Rect_size_for_20 + Rect_size_for_20;
            rc.bottom = y_field_bottom - Rect_size_for_20 * 6;
            rc.left = Rect_size_for_20;
            rc.right = Rect_size_for_20 * 3;

            //Create IPXC_CharFormat to modify font size 
            IPXC_CharFormat char_format = inst_pxc.CreateCharFormat();
            char_format.FontSize = 20;
            char_format.ModifyMask((uint)PXC_CharFormatMask.CFM_FontSize, 0);

            //Creation text block for keys text
            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(str_keys, ref rc, ref rc,
                (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter | (uint)PXC_DrawTextFlags.DTF_Justify,
                (int)-1, char_format, null, null, out rc_out);


            // Define the coordinates for Template text block
            rc.top = page_Height - Rect_size_for_20 * 2 + 50;
            rc.bottom = page_Height - Rect_size_for_20 - 30;
            rc.left = Rect_size_for_20;
            rc.right = page_Width - Rect_size_for_20;

            //Showing text block with Template name            
            string template_info = Get_Template_String();
            CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

            //Draw text block with current text in rc coordinates
            CC.ShowTextBlock(template_info, ref rc, ref rc,
                (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter
                | (uint)PXC_DrawTextFlags.DTF_Justify, (int)-1, char_format, null, null, out rc_out);

            for (int i = 1, key_counter = 0; i <= keys_count && key_counter < keys_count; i++, key_counter++)
            {
                int key_rect_top = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20 + Rect_size_for_20);
                int key_rect_bottom = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20);
                int key_rect_right = page_Width - Rect_size_for_20;
                int key_rect_left = Rect_size_for_20;
                Color current_key_color = workspace_ob.keys[key_counter].clr;
                string string_in_key_field = workspace_ob.clr_name[key_counter];

                string current_key_text = workspace_ob.keys[key_counter].str;

                // Define the coordinates for rect
                rc.top = key_rect_top;
                rc.bottom = key_rect_bottom;
                rc.left = key_rect_left;
                rc.right = key_rect_right / 4;

                if (key_colomn_number == Colomn_number.FIRST && rc.top >= Rect_size)
                {
                    DrawColoringRect(ref CC, ref rc, Color.White);

                    // Define the coordinates for rect
                    rc.top = key_rect_top + 30;
                    rc.bottom = key_rect_bottom - 30;

                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black)); //Set color of filling

                    //Draw text block with current text in rc coordinates
                    CC.ShowTextBlock(current_key_text, ref rc, ref rc,
                        (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                    rc.top = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left = key_rect_right / 4;
                    rc.right = key_rect_right / 2 - 2;

                    CC.Rect(rc.left, rc.bottom, rc.right, rc.top);//Draw rectangle by current coordinates
                    CC.SetFillColorRGB(Get_UINT_Color(current_key_color));//Set color of filling
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);//Filling current element

                    rc.top = key_rect_top + 50;
                    rc.bottom = key_rect_bottom - 50;
                    rc.left = key_rect_right / 4;
                    rc.right = key_rect_right / 2 - 2;

                    if (!isDarkColor(string_in_key_field))
                        CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling 
                    else
                        CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling 

                    CC.ShowTextBlock(string_in_key_field, ref rc, ref rc,
                        (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);
                }

                else
                {
                    if (key_colomn_number == Colomn_number.FIRST)
                    {
                        key_colomn_number = Colomn_number.SECOND;
                        i = 1;
                    }

                    key_rect_top = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20 + Rect_size_for_20);
                    key_rect_bottom = y_field_bottom - 2 * Rect_size_for_20 - (i * Rect_size_for_20);
                    key_rect_right = page_Width - Rect_size_for_20 - 6;
                    key_rect_left = key_rect_right / 2;

                    // Define the coordinates for rect
                    rc.top = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left = key_rect_left + 10;
                    rc.right = key_rect_left + (key_rect_right - key_rect_left) / 2;

                    CC.Rect(rc.left, rc.bottom, rc.right, rc.top);//Draw rectangle by current coordinates
                    CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);//Filling current element

                    // Define the coordinates for rect
                    rc.top = key_rect_top + 30;
                    rc.bottom = key_rect_bottom - 30;

                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling

                    //Draw text block with current text in rc coordinates
                    CC.ShowTextBlock(current_key_text, ref rc, ref rc,
                        (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                    rc.top = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left = rc.right;
                    rc.right = key_rect_left + (key_rect_right - key_rect_left);

                    CC.Rect(rc.left, rc.bottom, rc.right, rc.top);//Draw rectangle by current coordinates
                    CC.SetFillColorRGB(Get_UINT_Color(current_key_color));//Set color of filling
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);//Filling current element

                    rc.top = key_rect_top + 30;
                    rc.bottom = key_rect_bottom - 30;

                    rc.right = key_rect_right;

                    if (!isDarkColor(string_in_key_field))
                        CC.SetFillColorRGB(Get_UINT_Color(Color.Black));//Set color of filling 
                    else
                        CC.SetFillColorRGB(Get_UINT_Color(Color.White));//Set color of filling 

                    CC.ShowTextBlock(string_in_key_field, ref rc, ref rc,
                        (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);
                }
                page.PlaceContent(CC.Detach());//Appends drawn content to current page
                CC.SetLineWidth(0.5);//Set line  width
                CC.StrokePath(true);//Set end of drawing current element
            }

        }
Пример #16
0
        static public void AddImageFormFields(Form1 Parent)
        {
            int index = 1;
            //delegate string CheckNamesFields(IPXC_Document Doc, string fieldName, ref int x);
            CheckNamesFields checkNamesFields = (IPXC_Document Doc, string fName, ref int inx) =>
            {
                string sFieldName = "";
                uint   i          = 0;
                do
                {
                    sFieldName = fName + inx;
                    IPXC_FormField ff = Doc.AcroForm.GetFieldByName(sFieldName);
                    if (ff == null)
                    {
                        break;
                    }
                    inx++;
                    i++;
                }while (i <= Doc.AcroForm.FieldsCount);
                inx++;
                return(sFieldName);
            };

            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }

            PXC_Rect rc = new PXC_Rect();

            rc.top   = 800;
            rc.right = 600;

            //Adding button with icon as Image
            IPXC_UndoRedoData urD   = null;
            IPXC_Pages        pages = Parent.m_CurDoc.Pages;
            IPXC_Page         Page  = pages.InsertPage(0, rc, out urD);
            PXC_Rect          rcPB  = new PXC_Rect();

            rcPB.left   = 1.5 * 72.0;
            rcPB.right  = rcPB.left + 1.0 * 72.0;
            rcPB.top    = rc.top - 1.5 * 72.0;
            rcPB.bottom = rcPB.top - 2.0 * 72.0;             //top is greater then bottom (PDF Coordinate System)
            IPXC_FormField Image = Parent.m_CurDoc.AcroForm.CreateField(checkNamesFields(Parent.m_CurDoc, "Image", ref index), PXC_FormFieldType.FFT_PushButton, 0, ref rcPB);
            //Now we'll need to add the icon
            IPXC_Annotation       annot = Image.Widget[0];
            IPXC_AnnotData_Widget WData = (IPXC_AnnotData_Widget)annot.Data;
            string              sPath   = System.Environment.CurrentDirectory + "\\Images\\Editor_welcome.png";
            IPXC_Image          img     = Parent.m_CurDoc.AddImageFromFile(sPath);
            float               imgw    = img.Width;
            float               imgh    = img.Height;
            IPXC_ContentCreator CC      = Parent.m_CurDoc.CreateContentCreator();

            CC.SaveState();
            CC.ScaleCS(imgw, imgh);             //the image will be scaled to the button's size
            CC.PlaceImage(img);
            CC.RestoreState();
            IPXC_Content content = CC.Detach();
            PXC_Rect     rcBBox;

            rcBBox.left   = 0;
            rcBBox.top    = imgh;
            rcBBox.right  = imgw;
            rcBBox.bottom = 0;
            content.set_BBox(rcBBox);
            IPXC_XForm xForm = Parent.m_CurDoc.CreateNewXForm(ref rcPB);

            xForm.SetContent(content);
            WData.ButtonTextPosition = PXC_WidgetButtonTextPosition.WidgetText_IconOnly;
            WData.SetIcon(PXC_AnnotAppType.AAT_Normal, xForm, true);
            annot.Data = WData;
            Marshal.ReleaseComObject(Image);
            Marshal.ReleaseComObject(Page);
            Marshal.ReleaseComObject(pages);
        }
Пример #17
0
        private static void Draw_Keys(ref IPXC_ContentCreator CC, ref IPXC_Page page)
        {
            page_Width = 800;
            page_Height = 1200;
            Rect_size = (page_Width) / (workspace_ob.field_ex.size_rect - 8);
            height = workspace_ob.field_ex.heigth;
            width = workspace_ob.field_ex.width;
            keys_count = workspace_ob.keys.Count;

            

            CC.SetLineWidth(0.5);
            for (int i = 1, key_counter = 0; i <= keys_count && key_counter < keys_count; i++, key_counter++)
            {
                int key_rect_top = page_Height - (i * Rect_size);
                int key_rect_bottom = page_Height - (i * Rect_size) - Rect_size;
                int key_rect_right = page_Width - Rect_size;
                int key_rect_left = Rect_size;
                Color current_key_color = workspace_ob.keys[key_counter].clr;

                string current_key_text = workspace_ob.keys[key_counter].str;
                rc.top = key_rect_top;
                rc.bottom = key_rect_bottom;
                rc.left = Rect_size;
                rc.right = key_rect_right / 4;

                CC.Rect(rc.left, rc.bottom, rc.right, rc.top);
                CC.SetFillColorRGB(Get_UINT_Color(Color.White));
                CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);

                CC.SetFillColorRGB(Get_UINT_Color(Color.Black));
                CC.ShowTextBlock(current_key_text, ref rc, ref rc, (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                CC.Rect(key_rect_right / 4, key_rect_bottom, key_rect_right / 2 - 2, key_rect_top);
                CC.SetFillColorRGB(Get_UINT_Color(current_key_color));
                CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);

                page.PlaceContent(CC.Detach());
                try
                {
                    current_key_color = workspace_ob.keys[++key_counter].clr;

                    CC.Rect(key_rect_right / 2 + 2, key_rect_bottom, key_rect_right - (key_rect_right / 4), key_rect_top);
                    CC.SetFillColorRGB(Get_UINT_Color(Color.White));
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);

                    current_key_text = workspace_ob.keys[key_counter].str;
                    rc.top = key_rect_top;
                    rc.bottom = key_rect_bottom;
                    rc.left = key_rect_right / 2;
                    rc.right = key_rect_right - (key_rect_right / 4);

                    CC.SetFillColorRGB(Get_UINT_Color(Color.Black));
                    CC.ShowTextBlock(current_key_text, ref rc, ref rc, (uint)PXC_DrawTextFlags.DTF_Center | (uint)PXC_DrawTextFlags.DTF_VCenter, (int)-1, null, null, null, out rc_out);

                    CC.Rect(key_rect_right - (key_rect_right / 4), key_rect_bottom, key_rect_right, key_rect_top);
                    CC.SetFillColorRGB(Get_UINT_Color(current_key_color));
                    CC.FillPath(true, true, PXC_FillRule.FillRule_EvenOdd);
                }
                catch { break; }
                page.PlaceContent(CC.Detach());
            }
        }