private static Bitmap CreateErrorImg(string strFileName, string strErrorMessagae, string strSessionID)
        {
            Bitmap retValue = null;
            Bitmap temp     = null;

            if (strFileName == null || strFileName.Trim() == "")
            {
                retValue = new Bitmap(600, 200);
            }
            else
            {
                temp     = new Bitmap(BarcodeAccess.GetImgPathByName(strFileName, strSessionID));
                retValue = new Bitmap(temp.Width, temp.Height);
            }
            using (Graphics g = Graphics.FromImage(retValue))
            {
                if (strFileName == null || strFileName.Trim() == "")
                {
                    g.Clear(Color.Tan);
                }
                if (temp != null)
                {
                    g.DrawImage(temp, new Rectangle(0, 0, temp.Width, temp.Height), 0, 0, temp.Width, temp.Height, GraphicsUnit.Pixel);
                    temp.Dispose();
                }
                using (Font font = new Font("Times New Roman", 12, FontStyle.Bold))
                {
                    g.DrawString(strErrorMessagae, font, Brushes.Red, 2, 2);
                }
            }
            return(retValue);
        }
        private static Bitmap DoBarcode(string strImgID, Int64 format, string strSessionID, ref string strResult)
        {
            strResult = "";
            using (Bitmap bitmap = new Bitmap(BarcodeAccess.GetImgPathByName(strImgID, strSessionID)))
            {
                DateTime beginTime = DateTime.Now;

                BarcodeResult[] listResult = BarcodeMode.GetBarcode(bitmap, format, strSessionID);
                DateTime        afterTime  = DateTime.Now;
                TimeSpan        midTime    = afterTime - beginTime;
                if (listResult == null || listResult.Length == 0)
                {
                    throw new BarcodeException("No barcode found. Total time spent: " + midTime.TotalSeconds.ToString("F3") + " seconds.<br/>");
                }
                strResult = "Total barcode(s) found: " + listResult.Length + ". Total time spent: " + midTime.TotalSeconds.ToString("F3") + " seconds.<br/><br/>";
                Bitmap _bitmap = new Bitmap(bitmap.Width, bitmap.Height);
                using (Graphics g = Graphics.FromImage(_bitmap))
                {
                    g.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel);
                    float fsize = bitmap.Width / 80f;
                    if (fsize < 12)
                    {
                        fsize = 12;
                    }
                    using (Font font = new Font("Times New Roman", fsize, FontStyle.Bold))
                    {
                        int i = 1;
                        foreach (BarcodeResult Item in listResult)
                        {
                            strResult = strResult + "&nbsp&nbspBarcode " + i + ":<br/>";
                            strResult = strResult + "&nbsp&nbsp&nbsp&nbspPage: 1" + "<br/>";
                            strResult = strResult + "&nbsp&nbsp&nbsp&nbspType: " + Item.BarcodeFormat + "<br/>";
                            strResult = strResult + "&nbsp&nbsp&nbsp&nbspValue: " + Item.BarcodeText + "<br/>";
                            strResult = strResult + "&nbsp&nbsp&nbsp&nbspRegion: {left: " + Item.ResultPoints[0].X
                                        + ", Top: " + Item.ResultPoints[0].Y
                                        + ", Width: " + Item.BoundingRect.Width
                                        + ", Height: " + Item.BoundingRect.Height + "}<br/><br/>";
                            List <Point> listPoint = new List <Point>();
                            PointF       tmp       = new PointF(00, 40);
                            if (Item.ResultPoints.Length > 0)
                            {
                                tmp.X = (float)Item.ResultPoints[0].X;
                                tmp.Y = (float)Item.ResultPoints[0].Y;
                            }
                            SizeF sizeFT = g.MeasureString("[" + i + "]" + Item.BarcodeText, font);
                            if (tmp.Y + sizeFT.Height > _bitmap.Height)
                            {
                                tmp.Y = tmp.Y - 30 > 0 ? tmp.Y - 30 : 0;
                            }
                            if (sizeFT.Width + tmp.X > _bitmap.Width)
                            {
                                tmp.X = 0;
                            }
                            g.FillRectangle(Brushes.White, new RectangleF(new PointF(tmp.X, tmp.Y), sizeFT));
                            g.DrawString("[" + i + "]" + Item.BarcodeText, font, Brushes.Red, tmp.X, tmp.Y);

                            i++;
                        }
                    }
                }
                return(_bitmap);
            }
        }