/// <summary> /// 生成预览标签 /// </summary> private void PreLabels() { try { if (this.tabProLabel.SelectedIndex == 0) { this.report1 = this.report1 ?? new FastReport.Report(); this.report1.Load(@"labeltemplate1.frx"); //if (this.report1.FindObject("bcPro").GetType() == typeof(FastReport.Barcode.BarcodeObject)) //{ // (this.report1.FindObject("bcPro") as FastReport.Barcode.BarcodeObject).Text = this.txtBarCode.Text.Trim(); //} //else { // (this.report1.FindObject("bcPro") as FastReport.TextObject).Text = this.txtBarCode.Text.Trim(); // (this.report1.FindObject("bcProDis") as FastReport.TextObject).Text = this.txtBarCode.Text.Trim(); //} FastReport.PictureObject pojBarPic = this.report1.FindObject("bcProPic") as FastReport.PictureObject; pojBarPic.Image = GetBarCodeImg(this.txtBarCode.Text); MessageBox.Show(this.txtBarCode.Text); pojBarPic.Width = pojBarPic.Image.Width; pojBarPic.Height = pojBarPic.Image.Height; (this.report1.FindObject("txtName") as FastReport.TextObject).Text = this.txtInfos.Text; this.report1.Preview = this.previewControl1; this.report1.Show(); this.previewControl1.Zoom = 1.6f; } else { this.report2 = this.report2 ?? new FastReport.Report(); this.report2.Load(@"labeltemplate2.frx"); (this.report2.FindObject("txtInfo") as FastReport.TextObject).Text = this.txtInfoOther.Text; this.report2.Preview = this.previewControl2; this.report2.Show(); this.previewControl2.Zoom = 1f; } } catch { } }