コード例 #1
0
    public void Print()
    {
        Input_focuse = new TextBox()
        {
            Size        = new Size(0, 0),
            Location    = new Point(0, 0),
            ReadOnly    = true,
            BorderStyle = BorderStyle.None,
            BackColor   = Color.White
        };
        print_Form._formObject.Controls.Add(Input_focuse);

        printer_Menu = new ContextMenuStrip()
        {
            ShowImageMargin = false, Font = system_Font
        };
        printer_Item = new ToolStripMenuItem[printers.Count];
        for (int i = 0; i < printers.Count; i++)
        {
            printer_Item[i] = new ToolStripMenuItem()
            {
                AutoSize = true,
                Text     = printers[i].printerName,
                Tag      = i
            };
            printer_Item[i].Click += printerMenu_Click;
            printer_Menu.Items.Add(printer_Item[i]);
        }

        Bitmap[] printer_Img = new Bitmap[3] {
            EzRBuild.EzResource.print, EzRBuild.EzResource.prview, EzRBuild.EzResource.copy
        };
        string[] printer_text  = new string[] { "- 打印机选择:", "- 打印范围选择:", "- 打印方式:" };
        string[] printer_scope = new string[] { "全部", "单数页", "双数页" };
        int[]    _sety         = new int[] { 15, 86, 171 };
        int[]    _setx         = new int[] { 35, 90, 155 };
        for (int i = 0; i < 3; i++)
        {
            new RbControls_SpearLine().Spear_line(print_Form.form_panel, new Size(25, 25), new Point(10, _sety[i] - 2), printer_Img[i]);
            new RbControls_TextLabel().Text_Label(print_Form.form_panel, new Point(35, _sety[i]), system_Font, system_FontColor, printer_text[i]);

            select_Cope[i] = new RbControls_CheckBox();
            if (i == 0)
            {
                select_Cope[i].check_Box(print_Form.form_panel, true, i, new Point(_setx[i], 108), Color.Black, system_Font, printer_scope[i], check_AlwaysTrue, cope_Click);
            }
            else
            {
                select_Cope[i].check_Box(print_Form.form_panel, false, i, new Point(_setx[i], 108), Color.Black, system_Font, printer_scope[i], check_AlwaysTrue, cope_Click);
            }
        }
        new RbControls_SpearLine().Spear_line(print_Form.form_panel, new Size(380, 5), new Point(5, 70), EzRBuild.EzResource.hspear);
        new RbControls_SpearLine().Spear_line(print_Form.form_panel, new Size(380, 5), new Point(5, 158), EzRBuild.EzResource.hspear);

        Input_Printer = new RbControls_TextBox();
        Input_Printer.input_Box(print_Form.form_panel, 230, new Point(20, 40), system_Font, Color.Salmon, Color.White, DefaultPrinter, 1024, true, input_Normal, printer_Click, null);
        new RbControls_ButtonLabel().Button_Label(print_Form.form_panel, new Point(255, 40), Color.Black, system_btnEnter, Color.Black, "[◢ 选择设备 ]", system_Font, 0, SelectPrinter_Click);
        new RbControls_ButtonLabel().Button_Label(print_Form.form_panel, new Point(335, 40), Color.Black, system_btnEnter, Color.Black, "[ 属性 ]", system_Font, 0, PrinterAttrib_Click);

        Input_Scope = new RbControls_TextBox();
        Input_Scope.input_Box(print_Form.form_panel, 80, new Point(302, 133), system_Font, Color.Salmon, Color.White, "", 1024, false, input_Normal, null, Scope_KeyPress);
        new RbControls_TextLabel().Text_Label(print_Form.form_panel, new Point(35, 133), system_Font, Color.Black, "输入页码或范围(','或'-'分隔。例如1-5或1,3,4 ...):");

        Input_Copies = new RbControls_TextBox();
        Input_Copies.input_Box(print_Form.form_panel, 40, new Point(70, 195), system_Font, Color.Salmon, Color.White, "1", 3, false, input_Number, null, null);
        new RbControls_TextLabel().Text_Label(print_Form.form_panel, new Point(35, 195), system_Font, Color.Black, "份数:");

        string[] _ptype          = new string[] { "逐份打印", "逐页打印" };
        string[] acceptPrintMenu = new string[2] {
            "[✔ 确定 ]", "[✘ 取消 ]"
        };
        for (int i = 0; i < 2; i++)
        {
            select_ptype[i] = new RbControls_CheckBox();
            if (i == 0)
            {
                select_ptype[i].check_Box(print_Form.form_panel, true, i, new Point(135 + i * 75, 195), Color.Black, system_Font, _ptype[i], check_AlwaysTrue, ptype_Click);
            }
            else
            {
                select_ptype[i].check_Box(print_Form.form_panel, false, i, new Point(135 + i * 75, 195), Color.Black, system_Font, _ptype[i], check_AlwaysTrue, ptype_Click);
            }

            acceptPrint[i] = new RbControls_ButtonLabel();
            acceptPrint[i].Button_Label(print_Form.form_panel, new Point(260 + i * 65, 225), system_buttonColor, system_btnEnter, system_buttonColor, acceptPrintMenu[i], system_Font, i, AcceptPrinter_Click);
        }

        print_Form.Create_Dialog("print_Form", FormStartPosition.CenterScreen, new Size(390, 250), new Point(100, 200), Color.White, form_ShowDialog, true, null);
    }
コード例 #2
0
    private static ContextMenuStrip FontSize_Menu; // 字体大小菜单

    public static void Initialize_Info(Control obj)
    {
        PanelEx panel_TopLine = new PanelEx() // 间隔线
        {
            Dock                  = DockStyle.Top,
            Height                = 1,
            BackgroundImage       = EzRBuild.EzResource.line,
            BackgroundImageLayout = ImageLayout.Stretch
        };

        panel_State = new PanelEx() // 底部显示组件信息框
        {
            Size      = new Size(obj.Width - 4, 62),
            Location  = new Point(2, obj.Height - 64),
            Cursor    = Cursors.Default,
            BackColor = system_backColor
        };
        obj.Controls.Add(panel_State);

        pic_ControlType = new RbControls_SpearLine();
        pic_ControlType.Spear_line(panel_State, new Size(25, 25), new Point(2, 5), EzRBuild.EzResource.mouse);

        panel_State.Controls.Add(panel_TopLine);

        Label_ControlType = new RbControls_TextLabel();
        Label_ControlType.Text_Label(panel_State, new Point(27, 6), system_Font, system_FontColor, "");
        Label_ControlSize = new RbControls_TextLabel();
        Label_ControlSize.Text_Label(panel_State, new Point(7, 28), system_Font, system_FontColor, "范围:");
        Label_ControlPoint = new RbControls_TextLabel();
        Label_ControlPoint.Text_Label(panel_State, new Point(7, 44), system_Font, system_FontColor, "位置:");

        new RbControls_SpearLine().Spear_line(panel_State, new Size(5, 50), new Point(160, 8), EzRBuild.EzResource.spearInfo);

        panel_State.Controls.Add(panel_TopLine);

        // 获取字体
        InstalledFontCollection Fonts = new InstalledFontCollection();

        FontFamilies = Fonts.Families;
        Font_Menu    = new ContextMenuStrip()
        {
            ShowImageMargin = false, Font = system_Font
        };
        ToolStripMenuItem[] menu_Item = new ToolStripMenuItem[FontFamilies.Length];
        for (int i = FontFamilies.Length - 1; i > 0; i--)
        {
            menu_Item[i] = new ToolStripMenuItem()
            {
                AutoSize = true,
                Font     = system_Font,
                Text     = FontFamilies[i].Name,
            };
            menu_Item[i].Click += fontMenu_Click;
            Font_Menu.Items.Add(menu_Item[i]);
        }

        // 字体大小
        string[] size_value = new string[19] {
            "5", "6", "7", "8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72"
        };
        FontSize_Menu = new ContextMenuStrip()
        {
            ShowImageMargin = false, Font = system_Font
        };
        ToolStripMenuItem[] menu_ItemSize = new ToolStripMenuItem[19];
        for (int i = 0; i < 19; i++)
        {
            menu_ItemSize[i] = new ToolStripMenuItem()
            {
                AutoSize = true,
                Font     = system_Font,
                Text     = size_value[i],
            };
            menu_ItemSize[i].Click += sizeMenu_Click;
            FontSize_Menu.Items.Add(menu_ItemSize[i]);
        }


        for (int i = 0; i < 6; i++)
        {
            panel_setControl[i] = new PanelEx() // 设置框
            {
                Size      = new Size(1018, 50),
                Location  = new Point(175, 8),
                Visible   = false,
                BackColor = system_backColor
            };

            RbControls_TextLabel[] acceptLabels = new RbControls_TextLabel[2];
            string[] acceptMenu = new string[2] {
                "[✔ 应用设置 ]", "[✘ 删除组件 ]"
            };

            int[] _px = new int[2] {
                180, 635
            };
            for (int t = 0; t < 2; t++)
            {
                if (t == 0)
                {
                    new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(1 + t * 85, 4), system_buttonColor, Color.Salmon, system_buttonColor, acceptMenu[t], system_Font, t, accept_Attributes);
                }
                else
                {
                    new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(1 + t * 85, 4), system_buttonColor, Color.Salmon, system_buttonColor, acceptMenu[t], system_Font, t, null);
                }
                new RbControls_SpearLine().Spear_line(panel_setControl[i], new Size(5, 25), new Point(_px[t], 0), EzRBuild.EzResource.spear);
            }

            // 属性输入框
            int[] _inputX = new int[4] {
                230, 335, 450, 565
            };
            for (int t = 0; t < 4; t++)
            {
                attribute_Input[i, t] = new RbControls_TextBox();
                attribute_Input[i, t].input_Box(panel_setControl[i], 60, new Point(_inputX[t], 4), system_Font, Color.Salmon, system_backColor, "", 4, false, input_Number, null, null);
            }
            string label_txt = "宽度:                 高度:                 位置(x):                位置(y):                    颜色:";
            // 设置颜色
            if (i != 1)
            {
                new RbControls_PanelLine().Panel_Line(panel_setControl[i], new Size(30, 1), new Point(685, 20));
                Content_Color[i] = new RbControls_ColorPad();
                Content_Color[i].colorPad(panel_setControl[i], new Point(755, 7), new Size(11, 11), 15, Color.Transparent, colorSelect_Click);
                color_Flag[i] = new RbControls_TextLabel();
                color_Flag[i].Text_Label(panel_setControl[i], new Point(690, 3), system_Font, Color.Black, "█▌");
            }
            else
            {
                label_txt = "宽度:                 高度:                 位置(x):                位置(y):";
            }
            new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(195, 4), system_Font, system_FontColor, label_txt);

            // 对齐方式
            if (i != 2)
            {
                string[] align_label    = new string[] { "左", "右", "顶", "底", "居中", "垂直" };
                int[]    align_location = new int[] { 48, 83, 118, 153, 188, 233 };
                for (int t = 0; t < 6; t++)
                {
                    align_Check[i, t] = new RbControls_CheckBox();
                    if ((t == 0) || (t == 2))
                    {
                        align_Check[i, t].check_Box(panel_setControl[i], true, t, new Point(align_location[t], 30), system_FontColor, system_Font, align_label[t], check_AlwaysTrue, align_Click);
                    }
                    else
                    {
                        align_Check[i, t].check_Box(panel_setControl[i], false, t, new Point(align_location[t], 30), system_FontColor, system_Font, align_label[t], check_AlwaysTrue, align_Click);
                    }
                }
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(1, 31), system_Font, system_FontColor, "[ 对齐:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(281, 31), system_Font, system_FontColor, "]");
            }

            // 设置字体
            if ((i != 1) && (i != 2))
            {
                font_type[i] = new RbControls_TextLabel();
                font_type[i].Text_Label(panel_setControl[i], new Point(340, 31), system_Font, Color.Salmon, "微软雅黑");
                new RbControls_PanelLine().Panel_Line(panel_setControl[i], new Size(128, 1), new Point(345, 48));

                font_size[i] = new RbControls_TextLabel();
                font_size[i].Text_Label(panel_setControl[i], new Point(545, 31), system_Font, Color.Salmon, "9");
                new RbControls_PanelLine().Panel_Line(panel_setControl[i], new Size(37, 1), new Point(540, 48));

                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(300, 31), system_Font, system_FontColor, "[ 字体:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(487, 31), system_Font, system_FontColor, "] [ 字号:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(590, 31), system_Font, system_FontColor, "]");
                new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(475, 31), Color.Salmon, Color.Salmon, Color.Salmon, "◥", system_Font, 0, fontLabe_MouseDown);
                new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(575, 31), Color.Salmon, Color.Salmon, Color.Salmon, "◥", system_Font, 0, sizeLabe_MouseDown);

                string[] render_menu     = new string[] { "加粗", "倾斜", "下划线" };
                int[]    render_location = new int[] { 625, 675, 725 };
                for (int t = 0; t < 3; t++)
                {
                    font_render[i, t] = new RbControls_CheckBox();
                    font_render[i, t].check_Box(panel_setControl[i], false, t, new Point(render_location[t], 30), system_FontColor, system_Font, render_menu[t], check_Normal, null);
                }
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(610, 31), system_Font, system_FontColor, "[");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(785, 31), system_Font, system_FontColor, "]");
            }
            panel_State.Controls.Add(panel_setControl[i]);

            if (i == 0) // 文本框
            {
                content_TextInput = new RbControls_TextBox();
                content_TextInput.input_Box(panel_setControl[i], 168, new Point(830, 31), system_Font, Color.Salmon, system_backColor, "", 4096, false, input_Normal, null, null);
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(795, 31), system_Font, system_FontColor, "内容:");
                new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(1000, 33), Color.Salmon, Color.Salmon, Color.Salmon, "×", system_Font, 0, TextClear_Click);
            }

            if (i == 1) // 图像
            {
                content_ImgInput = new RbControls_TextBox();
                content_ImgInput.input_Box(panel_setControl[i], 150, new Point(520, 31), system_Font, Color.Salmon, system_backColor, "", 4096, false, 0, null, null);
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(450, 31), system_Font, system_FontColor, "图像文件:");

                string[] Img_Zoom = new string[2] {
                    "原始大小", "缩放"
                };
                for (int t = 0; t < 2; t++)
                {
                    ImgZoom_CheckBox[t] = new RbControls_CheckBox();
                    if (t == 0)
                    {
                        ImgZoom_CheckBox[t].check_Box(panel_setControl[i], false, t, new Point(315 + t * 75, 30), system_FontColor, system_Font, Img_Zoom[t], check_AlwaysTrue, ImgZoom_Click);
                    }
                    else
                    {
                        ImgZoom_CheckBox[t].check_Box(panel_setControl[i], true, t, new Point(315 + t * 75, 30), system_FontColor, system_Font, Img_Zoom[t], check_AlwaysTrue, ImgZoom_Click);
                    }
                }
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(300, 31), system_Font, system_FontColor, "[");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(435, 31), system_Font, system_FontColor, "]");

                string[] ImgZoom_text = new string[2] {
                    "◥", "×"
                };
                RbControls_ButtonLabel[] ImgZoom_Button = new RbControls_ButtonLabel[2];
                for (int t = 0; t < 2; t++)
                {
                    ImgZoom_Button[t] = new RbControls_ButtonLabel();
                    if (t == 0)
                    {
                        ImgZoom_Button[t].Button_Label(panel_setControl[i], new Point(673 + t * 18, 33), Color.Salmon, Color.Salmon, Color.Salmon, ImgZoom_text[t], system_Font, t, openImg_Click);
                    }
                    else
                    {
                        ImgZoom_Button[t].Button_Label(panel_setControl[i], new Point(673 + t * 18, 33), Color.Salmon, Color.Salmon, Color.Salmon, ImgZoom_text[t], system_Font, t, openClear_Click);
                    }
                }
            }

            if (i == 2) // 形状
            {
                Bitmap[] shaps_bmp = new Bitmap[20];
                for (int t = 0; t < 20; t++)
                {
                    shap_select[t] = new RbControls_CheckBox();
                    shap_select[t].check_Box(panel_setControl[i], false, t, new Point(48 + t * 40, 30), system_backColor, system_Font, null, check_AlwaysTrue, ShapSelect_Click);

                    shaps_bmp[t] = new Bitmap(20, 20);
                    ds.DrawFontAwesome(shaps_bmp[t], shaps_type[t], 20, Color.FromArgb(150, 150, 150), new Point(0, 0), false);

                    shaps_pic[t] = new Label()
                    {
                        Size      = new Size(20, 20),
                        Location  = new Point(65 + t * 40, 31),
                        Image     = shaps_bmp[t],
                        Cursor    = Cursors.Hand,
                        BackColor = Color.Transparent,
                        Tag       = t
                    };

                    shaps_pic[t].Click += ShapSelect_Click;
                    panel_setControl[i].Controls.Add(shaps_pic[t]);
                }
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(1, 31), system_Font, system_FontColor, "[ 样式:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(845, 31), system_Font, system_FontColor, "]");
            }

            if (i == 3) // 数据库字段
            {
                content_DataInput = new RbControls_TextBox();
                content_DataInput.input_Box(panel_setControl[i], 150, new Point(840, 31), system_Font, Color.Salmon, system_backColor, "", 4096, true, input_Normal, null, null);
                new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(990, 33), Color.Salmon, Color.Salmon, Color.Salmon, "◥", system_Font, 0, FieldSelect_MouseDown);
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(795, 31), system_Font, system_FontColor, "[ 字段:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(1005, 31), system_Font, system_FontColor, "]");

                DataField_Menu = new ContextMenuStrip()
                {
                    ShowImageMargin = false, Font = system_Font
                };
            }

            if (i == 4) // 页码
            {
                content_PcodeInput = new RbControls_TextBox();
                content_PcodeInput.input_Box(panel_setControl[i], 150, new Point(840, 31), system_Font, Color.Salmon, system_backColor, "", 64, true, input_Normal, null, null);
                new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(990, 33), Color.Salmon, Color.Salmon, Color.Salmon, "◥", system_Font, 0, pgCode_Click);
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(795, 31), system_Font, system_FontColor, "[ 样式:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(1005, 31), system_Font, system_FontColor, "]");

                string[] pgCode_MenuText = new string[8] {
                    "[1] , [2] , [3] , ...", "(1) , (2) , (3) , ...", "-1- , -2- , -3- , ...", "1 , 2 , 3 , ...", "-1 , -2 , -3 , ...", "1-99 , 2-99 , ...", "Page 1 of 99 , ...", "第1页 , 第2页 ..."
                };
                pgCode_Menu = new ContextMenuStrip()
                {
                    ShowImageMargin = false, Font = system_Font
                };
                ToolStripMenuItem[] menu_ItemCode = new ToolStripMenuItem[8];
                for (int t = 0; t < 8; t++)
                {
                    menu_ItemCode[t] = new ToolStripMenuItem()
                    {
                        AutoSize = true,
                        Font     = system_Font,
                        Text     = pgCode_MenuText[t],
                        Tag      = t
                    };
                    menu_ItemCode[t].Click += pgMenuCode_Click;
                    pgCode_Menu.Items.Add(menu_ItemCode[t]);
                }
            }

            if (i == 5) // 数据库运算
            {
                content_FunctionInput = new RbControls_TextBox();
                content_FunctionInput.input_Box(panel_setControl[i], 150, new Point(840, 31), system_Font, Color.Salmon, system_backColor, "", 4096, true, input_Normal, null, null);
                new RbControls_ButtonLabel().Button_Label(panel_setControl[i], new Point(990, 33), Color.Salmon, Color.Salmon, Color.Salmon, "◥", system_Font, 0, FieldFunction_MouseDown);
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(795, 31), system_Font, system_FontColor, "[ 运算:");
                new RbControls_TextLabel().Text_Label(panel_setControl[i], new Point(1005, 31), system_Font, system_FontColor, "]");

                DataField_Menu = new ContextMenuStrip()
                {
                    ShowImageMargin = false, Font = system_Font
                };
            }
        }

        Task View_ControlInfo = new Task(Set_ControlMoveInfo);

        View_ControlInfo.Start();
    }