コード例 #1
0
    /// <summary>
    /// 绘制形状
    /// </summary>
    /// <param name="gShap">画笔</param>
    /// <param name="_controlNum">组件序号</param>
    private static void Draw_Shape(Graphics gShap, int _controlNum)
    {
        if (DraggableObjects[_controlNum].isContent)
        {
            RbControls_DrawTextMethod ds = new RbControls_DrawTextMethod();

            Bitmap _bmp = new Bitmap(DraggableObjects[_controlNum].Region.Width, DraggableObjects[_controlNum].Region.Height);

            int _size  = 1;
            int _sizeX = 0;
            int _sizeY = 0;
            if (DraggableObjects[_controlNum].Region.Width > DraggableObjects[_controlNum].Region.Height)
            {
                _size  = DraggableObjects[_controlNum].Region.Height;
                _sizeX = (DraggableObjects[_controlNum].Region.Width - _size) / 2;
                _sizeY = 0;
            }
            else
            {
                _size  = DraggableObjects[_controlNum].Region.Width;
                _sizeX = 0;
                _sizeY = (DraggableObjects[_controlNum].Region.Height - _size) / 2;
            }

            ds.DrawFontAwesome(
                _bmp,
                shaps_type[DraggableObjects[_controlNum].Field_Shape],
                _size - 6,
                DraggableObjects[_controlNum].Field_ControlColor,
                new Point(_sizeX, _sizeY),
                false
                );
            gShap.DrawImage(_bmp, new PointF(6, 6));
        }
    }
コード例 #2
0
    /// <summary>
    /// 绘制文字
    /// </summary>
    /// <param name="gString">画笔</param>
    /// <param name="_controlNum">组件序号</param>
    private static void Draw_Text(Graphics gString, int _controlNum)
    {
        if (DraggableObjects[_controlNum].isContent)
        {
            RbControls_DrawTextMethod DrawText = new RbControls_DrawTextMethod();

            string _txt = DraggableObjects[_controlNum].Field_Text;
            if (DraggableObjects[_controlNum].ControlType == 4)
            {
                _txt = "[\"" + _txt + "\"]";
            }

            Font     fnt_Text   = new Font(DraggableObjects[_controlNum].Field_TextFont, DraggableObjects[_controlNum].Field_TextFontSize, DraggableObjects[_controlNum].Field_TextFontStyle, GraphicsUnit.Pixel);
            Bitmap   bmp_Text   = new Bitmap(DraggableObjects[_controlNum].Region.Width - 7, DraggableObjects[_controlNum].Region.Height - 7);
            Graphics gText      = Graphics.FromImage(bmp_Text);
            Point    point_text = RBuild_Info.TextPoint(_controlNum, bmp_Text.Width, bmp_Text.Height, gText, _txt, fnt_Text);
            DrawText.DrawString(bmp_Text, _txt, fnt_Text, DraggableObjects[_controlNum].Field_ControlColor, new Rectangle(point_text.X, point_text.Y, bmp_Text.Width, bmp_Text.Height));
            DraggableObjects[_controlNum].Field_Img = bmp_Text;
            gString.DrawImage(DraggableObjects[_controlNum].Field_Img, 3, 3, bmp_Text.Width, bmp_Text.Height);
        }
    }
コード例 #3
0
    /// <summary>
    /// 报表编辑
    /// </summary>
    public static void Initialize_Design()
    {
        printDocument = new PrintDocument();
        get_pageType();
        Initialize_PageMode();
        Set_PrintPageType(4, 0);

        // 获取打印机
        DefaultPrinter = printDocument.PrinterSettings.PrinterName;  //默认打印机名
        foreach (string sprint in PrinterSettings.InstalledPrinters) //获取所有打印机名称
        {
            printers.Add(new Printer_List(sprint));
        }

        Use_HotKey  = true;
        design_Form = new RbControls_FormCreate(); // 建立窗体

        RbControls_ConextMenu _ConextMenu = new RbControls_ConextMenu();

        _ConextMenu.Menu(design_Form.panel_Title, RBuild_Menu.total_Menu, RBuild_Menu.menu_text, RBuild_Menu.menu_point, 23, RBuild_Menu.menu_width, system_Font, Color.White, Color.FromArgb(241, 241, 241), Color.Black, RBuild_Menu.ToolMenuMove);
        _ConextMenu.text_label[0].BackColor = Color.FromArgb(241, 241, 241);
        _ConextMenu.text_label[0].ForeColor = Color.Black;

        // 工具栏
        for (int i = 0; i < 4; i++)
        {
            panel_Tool[i] = new PanelEx()
            {
                Dock = DockStyle.Top, Height = 35, Cursor = Cursors.Default, BackColor = Color.FromArgb(238, 238, 242)
            };
            PanelEx panel_Line = new PanelEx()
            {
                Dock = DockStyle.Bottom, Height = 1, BackgroundImage = EzRBuild.EzResource.line, BackgroundImageLayout = ImageLayout.Stretch
            };
            panel_Tool[i].Controls.Add(panel_Line);

            if (i == 0)
            {
                panel_Tool[i].Visible = true;
            }
            else
            {
                panel_Tool[i].Visible = false;
            }

            RBuild_Menu.tool_Control(i, panel_Tool[i]);
            design_Form._formObject.Controls.Add(panel_Tool[i]);
        }

        // 页面设计
        page_Desing = new PanelEx()
        {
            Size     = new Size(design_Form._formObject.Width - 4, design_Form._formObject.Height - 161),
            Cursor   = Cursors.Default,
            Location = new Point(2, 97)
        };
        design_Form._formObject.Controls.Add(page_Desing);

        // 页面容器
        page_Container = new PanelEx()
        {
            Size       = new Size(page_Desing.Width - 20, page_Desing.Height - 20),
            Location   = new Point(20, 20),
            AutoScroll = true,
            Cursor     = Cursors.Default,
            BackColor  = Color.FromArgb(195, 195, 195)
        };
        page_Container.Paint += RBuild_Paint.pageContainer_Paint;
        page_Desing.Controls.Add(page_Container);

        // 页面装入框
        int _iLeft = (page_Container.Width / 2) - (page_TypeFace.Page_Area.Width / 2);

        if (_iLeft < 0)
        {
            _iLeft = 0;
        }
        page_Install = new PanelEx()
        {
            Size      = new Size(page_TypeFace.Page_Area.Width + 20, page_TypeFace.Page_Area.Height + 20),
            Location  = new Point(_iLeft, 0),
            Cursor    = Cursors.Default,
            BackColor = Color.Transparent
        };
        page_Install.Paint += RBuild_Paint.pageInstall_Paint;
        page_Container.Controls.Add(page_Install);
        // 页面
        Print_PageType = new PanelEx()
        {
            Size      = page_TypeFace.Page_Area,
            Location  = new Point(10, 10),
            Cursor    = Cursors.Default,
            BackColor = Color.White
        };
        Print_PageType.Paint      += RBuild_Paint.PrintPageType_Paint;
        Print_PageType.Click      += RBuild_MouseEvent.PageType_Click;
        Print_PageType.MouseClick += RBuild_MouseEvent.PageType_MouseClick;
        Print_PageType.MouseUp    += RBuild_MouseEvent.PageType_MouseUp;
        Print_PageType.MouseDown  += RBuild_MouseEvent.PageType_MouseDown;
        Print_PageType.MouseMove  += RBuild_MouseEvent.PageType_MouseMove;
        page_Install.Controls.Add(Print_PageType);

        // 标尺
        PictureBoxEx pic_VRuler = new PictureBoxEx()
        {
            Dock      = DockStyle.Left,
            Image     = VRuler(1100),
            Width     = 20,
            Cursor    = Cursors.Default,
            BackColor = Color.White
        };

        page_Desing.Controls.Add(pic_VRuler);

        PictureBoxEx pic_HRuler = new PictureBoxEx()
        {
            Dock      = DockStyle.Top,
            Image     = HRuler(2000),
            Height    = 20,
            Cursor    = Cursors.Default,
            BackColor = Color.White
        };

        page_Desing.Controls.Add(pic_HRuler);

        Initialize_Band();
        RBuild_Menu.Initialize_MenuStrip();
        RBuild_Info.Initialize_Info(design_Form._formObject);


        RBuild_Info.Composite_Info = new RbControls_TextLabel();
        RBuild_Info.Composite_Info.Text_Label(
            design_Form.panel_Title, new Point(225, 40), system_Font, Color.FromArgb(230, 230, 230),
            "✐  当前纸张:" + page_types[page_TypeFace.Page_Type] + ", 纵向" + "  ✐  打印机:" + DefaultPrinter + "  ✐  数据库: None  ✐"
            );

        RbControls_DrawTextMethod ds = new RbControls_DrawTextMethod();
        Bitmap report_Icon           = new Bitmap(20, 20);

        ds.DrawFontAwesome(report_Icon, RbControls_FontAwesome.Type.FileText, 20, Color.FromArgb(250, 250, 250), new Point(0, 0), false);
        PictureBoxEx report_pic = new PictureBoxEx()
        {
            Size      = new Size(20, 20),
            Location  = new Point(10, 6),
            Image     = report_Icon,
            BackColor = Color.Transparent
        };

        design_Form.panel_Title.Controls.Add(report_pic);

        ReportFile_Name = new Label()
        {
            AutoSize  = true,
            Location  = new Point(30, 6),
            Font      = system_Font,
            ForeColor = Color.White,
            Text      = "MyReport.rpt",
            BackColor = Color.Transparent
        };
        design_Form.panel_Title.Controls.Add(ReportFile_Name);

        design_Form.Create_Form(page_Container, "design_Form", FormStartPosition.Manual, new Size(1200, 768), new Point(200, 100), system_backColor, form_ShowDialog, false, designForm_Close, formResize); // 显示窗体
    }
コード例 #4
0
    // 应用设置
    private static void accept_Attributes(object sender, EventArgs e)
    {
        if (DraggableObjects[control_Num].ControlType == 1)
        {
            if (content_TextInput.textBox.Text == "")
            {
                return;
            }
        }
        else
        if (DraggableObjects[control_Num].ControlType == 2)
        {
            if (content_ImgInput.textBox.Text == "")
            {
                if (!DraggableObjects[control_Num].isContent)
                {
                    return;
                }
            }
            else
            {
                try
                {
                    DraggableObjects[control_Num].Field_Img = Image.FromFile(content_ImgInput.textBox.Text) as Bitmap;
                }
                catch { return; }
            }
        }
        else
        if (DraggableObjects[control_Num].ControlType == 4)
        {
            if (content_DataInput.textBox.Text == "")
            {
                return;
            }
        }
        else
        if (DraggableObjects[control_Num].ControlType == 5)
        {
            if (content_PcodeInput.textBox.Text == "")
            {
                return;
            }
        }
        else
        if (DraggableObjects[control_Num].ControlType == 6)
        {
            if (content_FunctionInput.textBox.Text == "")
            {
                return;
            }
        }

        RbControls_DrawTextMethod DrawText = new RbControls_DrawTextMethod();
        int _controlType = 1;

        string TextAlign = "";

        if (DraggableObjects[control_Num].ControlType != 3) // 不是形状
        {
            if (align_Check[DraggableObjects[control_Num].ControlType - 1, 0].select)
            {
                TextAlign += "Left,";
            }
            if (align_Check[DraggableObjects[control_Num].ControlType - 1, 1].select)
            {
                TextAlign += "Right,";
            }
            if (align_Check[DraggableObjects[control_Num].ControlType - 1, 2].select)
            {
                TextAlign += "Top,";
            }
            if (align_Check[DraggableObjects[control_Num].ControlType - 1, 3].select)
            {
                TextAlign += "Bottom,";
            }
            if (align_Check[DraggableObjects[control_Num].ControlType - 1, 4].select)
            {
                TextAlign += "Middle,";
            }
            if (align_Check[DraggableObjects[control_Num].ControlType - 1, 5].select)
            {
                TextAlign += "Vertical,";
            }

            DraggableObjects[control_Num].Field_Align = TextAlign;
        }

        if ((DraggableObjects[control_Num].ControlType != 2) && (DraggableObjects[control_Num].ControlType != 3)) // 不是图像和形状
        {
            FontStyle fst = new FontStyle();
            if (font_render[DraggableObjects[control_Num].ControlType - 1, 0].select)
            {
                fst = FontStyle.Bold;
            }
            else
            {
                fst = FontStyle.Regular;
            }
            if (font_render[DraggableObjects[control_Num].ControlType - 1, 1].select)
            {
                fst = fst | FontStyle.Italic;
            }
            if (font_render[DraggableObjects[control_Num].ControlType - 1, 2].select)
            {
                fst = fst | FontStyle.Underline;
            }

            Font fnt = new Font(font_type[DraggableObjects[control_Num].ControlType - 1].labelText.Text, int.Parse(font_size[0].labelText.Text), fst, GraphicsUnit.Pixel);
            DraggableObjects[control_Num].Field_TextFontStyle = fst;

            Bitmap   bmp_Text = new Bitmap(DraggableObjects[control_Num].Region.Width, DraggableObjects[control_Num].Region.Height);
            Graphics gText    = Graphics.FromImage(bmp_Text);

            string _text = "";
            if (DraggableObjects[control_Num].ControlType == 1)
            {
                _text = content_TextInput.textBox.Text;
            }
            if (DraggableObjects[control_Num].ControlType == 4)
            {
                _text = content_DataInput.textBox.Text;
            }
            if (DraggableObjects[control_Num].ControlType == 5)
            {
                _text = content_PcodeInput.textBox.Text;
            }
            if (DraggableObjects[control_Num].ControlType == 6)
            {
                _text = content_FunctionInput.textBox.Text;
            }

            Point point_text = TextPoint(control_Num, bmp_Text.Width - 7, bmp_Text.Height - 7, gText, _text, fnt);

            DrawText.DrawString(bmp_Text, _text, fnt, color_Flag[DraggableObjects[control_Num].ControlType - 1].labelText.ForeColor, new Rectangle(point_text.X, point_text.Y, bmp_Text.Width, bmp_Text.Height));
            DraggableObjects[control_Num].Field_Img           = bmp_Text;
            DraggableObjects[control_Num].Field_Text          = _text;
            DraggableObjects[control_Num].Field_TextFont      = font_type[DraggableObjects[control_Num].ControlType - 1].labelText.Text;
            DraggableObjects[control_Num].Field_TextFontSize  = int.Parse(font_size[DraggableObjects[control_Num].ControlType - 1].labelText.Text);
            DraggableObjects[control_Num].Field_TextFontStyle = fst;
            DraggableObjects[control_Num].Field_Align         = TextAlign;
            DraggableObjects[control_Num].Field_ControlColor  = color_Flag[DraggableObjects[control_Num].ControlType - 1].labelText.ForeColor;

            if (DraggableObjects[control_Num].ControlType == 6)
            {
                DraggableObjects[control_Num].Field_Calculate = content_FunctionInput.textBox.Text;
            }
        }

        if (DraggableObjects[control_Num].ControlType == 2) // 图像
        {
            if (ImgZoom_CheckBox[0].select)
            {
                DraggableObjects[control_Num].Field_ImgZoom = 0;
            }
            else
            {
                DraggableObjects[control_Num].Field_ImgZoom = 1;
            }
            _controlType = 2;
        }

        if (DraggableObjects[control_Num].ControlType == 3) // 形状
        {
            for (int i = 0; i < 20; i++)
            {
                if (shap_select[i].select)
                {
                    DraggableObjects[control_Num].Field_Shape = i;
                    break;
                }
            }
            _controlType = 3;
            DraggableObjects[control_Num].Field_ControlColor = color_Flag[DraggableObjects[control_Num].ControlType - 1].labelText.ForeColor;
        }

        DraggableObjects[control_Num].isContent = true;

        DraggableObjects[control_Num].Region = new Rectangle(
            int.Parse(attribute_Input[DraggableObjects[control_Num].ControlType - 1, 2].textBox.Text),
            int.Parse(attribute_Input[DraggableObjects[control_Num].ControlType - 1, 3].textBox.Text),
            int.Parse(attribute_Input[DraggableObjects[control_Num].ControlType - 1, 0].textBox.Text),
            int.Parse(attribute_Input[DraggableObjects[control_Num].ControlType - 1, 1].textBox.Text)
            );

        DraggableObjects[control_Num].Setimage = LinBox(
            DraggableObjects[control_Num].Region.Width,
            DraggableObjects[control_Num].Region.Height,
            1,
            _controlType,
            control_Num
            );
        Print_PageType.Invalidate();
        Object_Record();
        ReportChange_Flag = true;
    }