Display container showCompanyvertical()
{
System.Drawing.Bitmap BarcodeBitmap;
System.Drawing.Graphics BarcodeGraphics;
int dx=200;
int dy=200;
str barcodetxt;
Image BarcodeImage;
System.Drawing.Pen TxtPen;
System.Drawing.Brush TxtBrush;
System.Drawing.Brush DrawBrush;
System.Drawing.StringFormat StringFormat;
System.Drawing.StringAlignment StringAlignment;
System.Drawing.Font BarcodeFont = new System.Drawing.Font(‘Times New Roman’,12,System.Drawing.FontStyle::Regular);
Int64 BarcodeBitmapPtr;
BarcodeCode128 MyBarcode = BarcodeCode128::construct();
;
BarcodeImage = new Image();
BarcodeBitmap = new System.Drawing.Bitmap(dx,dy);
BarcodeGraphics = System.Drawing.Graphics::FromImage(BarcodeBitmap);
barcodetxt =this.companyName()+”\n”+ this.companyAddress();
// clear canvas
DrawBrush = System.Drawing.Brushes::get_White();
BarcodeGraphics.FillRectangle(DrawBrush,0,0,any2int(dx),any2int(dy));
// set barcode text
TxtBrush = System.Drawing.Brushes::get_Black();
TxtPen = new System.Drawing.Pen(TxtBrush);
// set text alignment
StringFormat = new System.Drawing.StringFormat();
StringAlignment = System.Drawing.StringAlignment::Center;
StringFormat.set_Alignment(StringAlignment);
StringFormat.set_LineAlignment(StringAlignment);
// init rotation
BarcodeGraphics.TranslateTransform(any2int(dx),0);
BarcodeGraphics.RotateTransform(90);
// draw text
BarcodeGraphics.DrawString(barcodetxt, BarcodeFont,TxtBrush, any2int(dx/2) , any2int(dy/2),StringFormat);
// transfer image to Ax
BarcodeBitmapPtr=BarcodeBitmap.GetHbitmap();
BarcodeImage.importBitmap(BarcodeBitmapPtr);
return BarcodeImage.getData();
}
Tip: Watch out with the ResizeBitmap property.