Ejemplo n.º 1
0
        /// <summary>
        /// 生成显示图片的PictureBox
        /// </summary>
        /// <param name="type"></param>
        /// <param name="exinfo"></param>
        private void GenerateImagePictureBox(string type, ExportInfo exinfo = null)
        {
            GetExportInfoValue(exinfo);
            PrintPreviewPictureBox PicBox = null;

            try
            {
                switch (type)
                {
                case "image":
                    PicBox = new PrintPreviewImagePictureBox(PreviewControlPanel, exinfo);
                    break;

                case "qrcode":
                    PicBox = new PrintPreviewQRCodePictureBox(PreviewControlPanel, exinfo);
                    break;

                case "barcode":
                    PicBox = new PrintPreviewBarCodePictureBox(PreviewControlPanel, exinfo);
                    break;

                case "background":
                    PicBox = new PrintPreviewBackgroundPictureBox(PreviewControlPanel, exinfo);
                    break;
                }
                PicBox.GeneratePictureBoxFillImage(exinfo);
            }
            finally
            {
                if (PicBox != null)
                {
                    PicBox.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 生成显示图片的PictureBox
        /// </summary>
        private PrintPreviewPictureBox GenerateImagePictureBox(ExportInfo exinfo = null)
        {
            GetExportInfoValue(exinfo);
            PrintPreviewPictureBox tempPicBox = null;
            PrintPreviewPictureBox PicBox     = null;

            try
            {
                switch (exinfo.TagInfo.Type)
                {
                case "image":
                    tempPicBox = new PrintPreviewImagePictureBox(PreviewControlPanel, exinfo);
                    break;

                case "qrcode":
                    tempPicBox = new PrintPreviewQRCodePictureBox(PreviewControlPanel, exinfo);
                    break;

                case "barcode":
                    tempPicBox = new PrintPreviewBarCodePictureBox(PreviewControlPanel, exinfo);
                    break;

                case "background":
                    tempPicBox = new PrintPreviewBackgroundPictureBox(PreviewControlPanel, exinfo);
                    break;
                }
                tempPicBox.Resize += new EventHandler(tempPreviewPicBox_Resize);
                ShowExinfo(exinfo);
                tempPicBox.GeneratePictureBoxFillImage(exinfo);
                ControlDetail = string.Empty;
                PicBox        = tempPicBox;
                tempPicBox    = null;
            }
            finally
            {
                if (tempPicBox != null)
                {
                    tempPicBox.Dispose();
                }
            }
            return(PicBox);
        }