private DevExpress.XtraReports.UI.XRTableCell GetCellStampEx(int left, int top, string tenDV) { DevExpress.XtraReports.UI.XRTableCell cell = new DevExpress.XtraReports.UI.XRTableCell(); cell.Location = new Point(left, top); cell.Size = new Size(this.widthStamp, this.heightStamp); cell.BorderColor = Color.Black; cell.Borders = DevExpress.XtraPrinting.BorderSide.All; cell.BorderWidth = this.borderStamp; int h = GetHeightPos(); int startleft = (this.widthStamp - this.widthBarcode) / 2; int starttop = (this.heightStamp - h) / 2; for (int i = 0; i < 4; i++) { if (this.pos[i] == StyleLabelBarcode.Unit) { DevExpress.XtraReports.UI.XRLabel lbUnit = new DevExpress.XtraReports.UI.XRLabel(); lbUnit.Text = tenDV; lbUnit.TextAlignment = this.alight[i]; lbUnit.Font = fontUnit; lbUnit.Location = new Point(startleft, starttop); lbUnit.Size = new Size(this.widthBarcode, this.heightUnit); lbUnit.BorderWidth = 0; starttop += heightUnit - delta; cell.Controls.Add(lbUnit); } else if (this.pos[i] == StyleLabelBarcode.Name) { DevExpress.XtraReports.UI.XRLabel lbName = new DevExpress.XtraReports.UI.XRLabel(); lbName.Text = "Tên sản phẩm"; lbName.TextAlignment = this.alight[i]; lbName.Font = fontName; lbName.BorderWidth = 0; lbName.Location = new Point(startleft, starttop); lbName.Size = new Size(this.widthBarcode, this.heightName); starttop += heightName - delta; cell.Controls.Add(lbName); } else if (this.pos[i] == StyleLabelBarcode.Barcode) { DevExpress.XtraReports.UI.XRBarCode bcode = new DevExpress.XtraReports.UI.XRBarCode(); bcode.Alignment = this.alight[i]; bcode.BorderWidth = 0; bcode.Location = new System.Drawing.Point(startleft, starttop); bcode.Module = this.moduleBarcode; bcode.Size = new System.Drawing.Size(this.widthBarcode, this.heightBarcode); bcode.Symbology = GetBCSymbology(this.symBC); if (this.symBC == BarCodeType.EAN13) bcode.Text = this.mauEAN13; else bcode.Text = this.mauKhac; bcode.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; starttop += this.heightBarcode - delta; cell.Controls.Add(bcode); } else if (this.pos[i] == StyleLabelBarcode.Price) { DevExpress.XtraReports.UI.XRLabel lbPrice = new DevExpress.XtraReports.UI.XRLabel(); lbPrice.Text = "Giá sản phẩm"; lbPrice.TextAlignment = this.alight[i]; lbPrice.Font = fontPrice; lbPrice.BorderWidth = 0; lbPrice.Location = new Point(startleft, starttop); lbPrice.Size = new Size(this.widthBarcode, this.heightPrice); starttop += heightPrice - delta; cell.Controls.Add(lbPrice); } } return cell; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { DevExpress.XtraPrinting.BarCode.Code128Generator code128Generator1 = new DevExpress.XtraPrinting.BarCode.Code128Generator(); this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.xrPictureBox2 = new DevExpress.XtraReports.UI.XRPictureBox(); this.xrBarCode2 = new DevExpress.XtraReports.UI.XRBarCode(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail // this.Detail.BackColor = System.Drawing.Color.Transparent; this.Detail.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrPictureBox2, this.xrBarCode2, this.xrLabel3, this.xrLabel2, this.xrPictureBox1, this.xrLabel1 }); this.Detail.Height = 349; this.Detail.Name = "Detail"; this.Detail.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.Detail.PageBreak = DevExpress.XtraReports.UI.PageBreak.BeforeBand; this.Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // xrPictureBox2 // this.xrPictureBox2.Location = new System.Drawing.Point(248, 27); this.xrPictureBox2.Name = "xrPictureBox2"; this.xrPictureBox2.Size = new System.Drawing.Size(90, 30); // // xrBarCode2 // this.xrBarCode2.Alignment = DevExpress.XtraPrinting.TextAlignment.TopCenter; this.xrBarCode2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "strMembershipID", "") }); this.xrBarCode2.Font = new System.Drawing.Font("Times New Roman", 8F); this.xrBarCode2.Location = new System.Drawing.Point(50, 227); this.xrBarCode2.Module = 1F; this.xrBarCode2.Name = "xrBarCode2"; this.xrBarCode2.Padding = new DevExpress.XtraPrinting.PaddingInfo(10, 10, 0, 0, 100F); this.xrBarCode2.Size = new System.Drawing.Size(233, 42); this.xrBarCode2.Symbology = code128Generator1; // // xrLabel3 // this.xrLabel3.Font = new System.Drawing.Font("Verdana", 8.25F); this.xrLabel3.Location = new System.Drawing.Point(0, 142); this.xrLabel3.Name = "xrLabel3"; this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel3.Size = new System.Drawing.Size(17, 17); this.xrLabel3.Text = "."; this.xrLabel3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // xrLabel2 // this.xrLabel2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "strCardName", "") }); this.xrLabel2.Font = new System.Drawing.Font("Arial", 9F); this.xrLabel2.Location = new System.Drawing.Point(11, 177); this.xrLabel2.Name = "xrLabel2"; this.xrLabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel2.Size = new System.Drawing.Size(209, 19); this.xrLabel2.Text = "xrLabel2"; this.xrLabel2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // xrPictureBox1 // this.xrPictureBox1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Image", null, "imgPhoto", "") }); this.xrPictureBox1.Location = new System.Drawing.Point(22, 19); this.xrPictureBox1.Name = "xrPictureBox1"; this.xrPictureBox1.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.xrPictureBox1.Size = new System.Drawing.Size(99, 119); this.xrPictureBox1.Sizing = DevExpress.XtraPrinting.ImageSizeMode.StretchImage; // // xrLabel1 // this.xrLabel1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "strMembershipID", "") }); this.xrLabel1.Font = new System.Drawing.Font("Verdana", 8.25F); this.xrLabel1.Location = new System.Drawing.Point(11, 162); this.xrLabel1.Name = "xrLabel1"; this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel1.Size = new System.Drawing.Size(209, 19); this.xrLabel1.Text = "xrLabel1"; this.xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // XtraReportMemberCard // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { this.Detail }); this.Landscape = true; this.Margins = new System.Drawing.Printing.Margins(0, 0, 1, 0); this.PageHeight = 353; this.PageWidth = 214; this.PaperKind = System.Drawing.Printing.PaperKind.Custom; this.PaperName = "CR-79"; this.Version = "8.3"; ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }
public void GetCellStamp(DevExpress.XtraReports.UI.XRTableCell cell, DataRow dr, int cellWidth, int cellHeight) { int h = GetHeightPos(); //int startleft = left; //int starttop = top; //int startleft = (this.widthStamp - this.widthBarcode) / 2; //int starttop = (this.heightStamp - h) / 2; int startleft = Math.Abs((cellWidth - this.widthStamp) / 2); int starttop = Math.Abs((cellHeight - this.heightStamp) / 2); for (int i = 0; i < 4; i++) { if (this.pos[i] == StyleLabelBarcode.Unit) { DevExpress.XtraReports.UI.XRLabel lbUnit = new DevExpress.XtraReports.UI.XRLabel(); //lbUnit.Text = dr[this.fieldUnit].ToString(); lbUnit.Text = this.barcode_param; lbUnit.TextAlignment = this.alight[i]; lbUnit.Font = fontUnit; lbUnit.Location = new Point(startleft, starttop); lbUnit.SizeF = new SizeF(this.widthBarcode, this.heightUnit); lbUnit.BorderWidth = 0; starttop += heightUnit - delta; cell.Controls.Add(lbUnit); } else if (this.pos[i] == StyleLabelBarcode.Name) { DevExpress.XtraReports.UI.XRLabel lbName = new DevExpress.XtraReports.UI.XRLabel(); lbName.Text = dr[this.fieldName].ToString(); lbName.TextAlignment = this.alight[i]; lbName.Font = fontName; lbName.BorderWidth = 0; lbName.Location = new Point(startleft, starttop); lbName.SizeF = new SizeF(this.widthBarcode, this.heightName); starttop += heightName - delta; cell.Controls.Add(lbName); } else if (this.pos[i] == StyleLabelBarcode.Barcode) { DevExpress.XtraReports.UI.XRBarCode bcode = new DevExpress.XtraReports.UI.XRBarCode(); bcode.Alignment = this.alight[i]; bcode.BorderWidth = 0; bcode.Location = new System.Drawing.Point(startleft, starttop); bcode.Module = this.moduleBarcode; bcode.SizeF = new System.Drawing.SizeF(this.widthBarcode, this.heightBarcode); bcode.Symbology = GetBCSymbology(this.symBC); //bcode.Text = this.idCountry + this.idProvider + dr[this.fieldId].ToString(); //if (this.symBC == BarCodeType.EAN13)// DevExpress.XtraReports.UI.BarCode.XRBarCodeSymbology.EAN13 // bcode.Text = this.idCountry + this.idProvider + dr[this.fieldId].ToString(); //else bcode.Text = dr[this.fieldId].ToString(); bcode.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; starttop += this.heightBarcode - delta; cell.Controls.Add(bcode); } else if (this.pos[i] == StyleLabelBarcode.Price) { DevExpress.XtraReports.UI.XRLabel lbPrice = new DevExpress.XtraReports.UI.XRLabel(); lbPrice.Text = dr[this.fieldPrice].ToString(); lbPrice.TextAlignment = this.alight[i]; lbPrice.Font = fontPrice; lbPrice.BorderWidth = 0; lbPrice.Location = new Point(startleft, starttop); lbPrice.SizeF = new SizeF(this.widthBarcode, this.heightPrice); starttop += heightPrice - delta; cell.Controls.Add(lbPrice); } } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { DevExpress.XtraReports.UI.BarCode.XRCode128Generator xrCode128Generator1 = new DevExpress.XtraReports.UI.BarCode.XRCode128Generator(); this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.xrBarCode2 = new DevExpress.XtraReports.UI.XRBarCode(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail // this.Detail.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrBarCode2, this.xrLabel3, this.xrLabel2, this.xrPictureBox1, this.xrLabel1}); this.Detail.Height = 349; this.Detail.Name = "Detail"; this.Detail.PageBreak = DevExpress.XtraReports.UI.PageBreak.BeforeBand; this.Detail.ParentStyleUsing.UseBackColor = false; // // xrBarCode2 // this.xrBarCode2.Alignment = DevExpress.XtraPrinting.TextAlignment.TopCenter; this.xrBarCode2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "strMembershipID", "")}); this.xrBarCode2.Font = new System.Drawing.Font("Times New Roman", 8F); this.xrBarCode2.Location = new System.Drawing.Point(50, 227); this.xrBarCode2.Module = 1F; this.xrBarCode2.Name = "xrBarCode2"; this.xrBarCode2.ParentStyleUsing.UseFont = false; this.xrBarCode2.Size = new System.Drawing.Size(233, 42); this.xrBarCode2.Symbology = xrCode128Generator1; // // xrLabel3 // this.xrLabel3.Font = new System.Drawing.Font("Verdana", 8.25F); this.xrLabel3.Location = new System.Drawing.Point(0, 142); this.xrLabel3.Name = "xrLabel3"; this.xrLabel3.ParentStyleUsing.UseFont = false; this.xrLabel3.Size = new System.Drawing.Size(17, 17); this.xrLabel3.Text = "."; // // xrLabel2 // this.xrLabel2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "strCardName", "")}); this.xrLabel2.Font = new System.Drawing.Font("Arial", 9F); this.xrLabel2.Location = new System.Drawing.Point(11, 177); this.xrLabel2.Name = "xrLabel2"; this.xrLabel2.ParentStyleUsing.UseFont = false; this.xrLabel2.Size = new System.Drawing.Size(209, 19); this.xrLabel2.Text = "xrLabel2"; // // xrPictureBox1 // this.xrPictureBox1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Image", null, "imgPhoto", "")}); this.xrPictureBox1.Location = new System.Drawing.Point(22, 19); this.xrPictureBox1.Name = "xrPictureBox1"; this.xrPictureBox1.Size = new System.Drawing.Size(99, 119); this.xrPictureBox1.Sizing = DevExpress.XtraPrinting.ImageSizeMode.StretchImage; // // xrLabel1 // this.xrLabel1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "strMembershipID", "")}); this.xrLabel1.Font = new System.Drawing.Font("Verdana", 8.25F); this.xrLabel1.Location = new System.Drawing.Point(11, 162); this.xrLabel1.Name = "xrLabel1"; this.xrLabel1.ParentStyleUsing.UseFont = false; this.xrLabel1.Size = new System.Drawing.Size(209, 19); this.xrLabel1.Text = "xrLabel1"; // // XtraReportMemberCard // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { this.Detail}); this.Landscape = true; this.Margins = new System.Drawing.Printing.Margins(0, 0, 1, 0); this.PageHeight = 353; this.PageWidth = 214; this.PaperKind = System.Drawing.Printing.PaperKind.Custom; this.PaperName = "CR-79"; ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }