/// <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(); } } }
/// <summary> /// 控件大小发生改变 /// </summary> private void tempPreviewPicBox_Resize(object sender, EventArgs e) { PrintPreviewPictureBox picbox = sender as PrintPreviewPictureBox; if (picbox == null && picbox.ResetMode) { ControlWidth = picbox.Width; ControlHeight = picbox.Height; } }
/// <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); }