示例#1
0
        private void Doc_PrintPage(object sender, PrintPageEventArgs e)
        {
            try
            {
                //Print image
                // Bitmap bm = new Bitmap(picBarCode.Image);

                e.Graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                e.Graphics.PixelOffsetMode    = PixelOffsetMode.Half;
                e.Graphics.SmoothingMode      = SmoothingMode.AntiAlias;
                e.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
                e.Graphics.CompositingMode    = CompositingMode.SourceCopy;

                //e.Graphics.DrawImage(bm, 0, 0);
                //bm.Dispose();

                using (Graphics g = e.Graphics)
                {
                    string strBarCodeSettingValue = GetBarCodeSettings();
                    if (strBarCodeSettingValue != null)
                    {
                        string[] strfiles = strBarCodeSettingValue.Split('\n');

                        if (strfiles.Length > 0)
                        {
                            //  string ProductID = _PrintRowData.Cells["ColProductID"].Value.ToString();
                            //obj.Controls.Clear();
                            //    obj.Refresh();
                            // AddNewPage();

                            if (strfiles.Length > 0)
                            {
                                for (int i = 0; i < strfiles.Length; i++)
                                {
                                    string[] strInfo = strfiles[i].Split('@');

                                    if (i == 0)
                                    {
                                        // set the back color and size of the page.
                                        // obj.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[0]));
                                        //obj.Size = new Size(Convert.ToInt32(strInfo[1]), Convert.ToInt32(strInfo[2]));
                                    }
                                    else
                                    { //Type-IsBold-Family-argb(int)-fsize(float)-w-h-x-y-text-backColor(int)-RecBorderStyle-borderStyle-borderColor
                                        if (strInfo[0] == "Label")
                                        {
                                            Label objLable = new Label();
                                            if (strInfo[1] == "True")
                                            {
                                                objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                            }
                                            else
                                            {
                                                objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                            }

                                            objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                            objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                            objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                            objLable.Text      = strInfo[9];
                                            objLable.BackColor = Color.Green;
                                            objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                            objLable.Tag       = strInfo[14];
                                            try
                                            {
                                                // int to enum
                                                objLable.TextAlign = (ContentAlignment)Convert.ToInt32(strInfo[15]);
                                            }
                                            catch
                                            {
                                            }
                                            SetBarCodeValues(objLable, _PrintRowData);

                                            //obj.Controls.Add(objLable);
                                            //obj.Refresh();

                                            StringFormat sf = new StringFormat();
                                            sf.LineAlignment = StringAlignment.Center;
                                            sf.Alignment     = StringAlignment.Center;

                                            string caption3 = string.Format(objLable.Text);
                                            if (objLable.TextAlign == ContentAlignment.MiddleCenter)
                                            {
                                                // get the location of that control respective to bardcode panel
                                                RectangleF drawRect = objLable.ClientRectangle;
                                                drawRect.X = objLable.Location.X;
                                                drawRect.Y = objLable.Location.Y;

                                                // DRAW BACKGROUND REC ( Important for Testing )
                                                //Pen blackPen = new Pen(Color.Red);
                                                //e.Graphics.DrawRectangle(blackPen,drawRect.X,drawRect.Y,drawRect.Width,drawRect.Height);

                                                // Set format of string.
                                                StringFormat drawFormat = new StringFormat();
                                                drawFormat.Alignment = StringAlignment.Center;

                                                g.DrawString(caption3, objLable.Font, System.Drawing.Brushes.Black, drawRect, drawFormat);
                                            }
                                            else
                                            {
                                                g.DrawString(caption3, objLable.Font, System.Drawing.Brushes.Black, objLable.Location.X, objLable.Location.Y);
                                            }
                                        }
                                        else if (strInfo[0] == "VerticalLabel")
                                        {
                                            VerticalLabel objLable = new VerticalLabel();
                                            if (strInfo[1] == "True")
                                            {
                                                objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                            }
                                            else
                                            {
                                                objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                            }
                                            objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                            objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                            objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                            objLable.Text      = strInfo[9];
                                            objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                            objLable.Tag       = strInfo[14];

                                            SetBarCodeValues(objLable, _PrintRowData);

                                            //obj.Controls.Add(objLable);
                                            // obj.Refresh();

                                            string captionText   = objLable.Text;
                                            Size   preferredSize = g.MeasureString(objLable.Text, objLable.Font).ToSize();

                                            // change this value
                                            int padding = 20;

                                            DrawRotatedTextAt(g, -90, captionText,
                                                              objLable.Location.X, objLable.Location.Y + preferredSize.Width + padding, objLable.Font, Brushes.Black);
                                        }
                                        else if (strInfo[0] == "PictureBox")
                                        {
                                            PictureBox objPicBox = new PictureBox();
                                            objPicBox.Size        = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                            objPicBox.Location    = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                            objPicBox.BorderStyle = BorderStyle.FixedSingle;
                                            objPicBox.Image       = Barcode.clsBarCodeUtility.GenerateBarCode(_Current_BarCodeNumber);
                                            objPicBox.SizeMode    = PictureBoxSizeMode.StretchImage;
                                            // objPicBox.MouseLeave += new EventHandler(obj.control_MouseLeave);
                                            //obj.Controls.Add(objPicBox);

                                            // this code is specific to MD :
                                            if (!chkPrintRate.Checked)
                                            {
                                                objPicBox.Height = objPicBox.Height + 15;
                                            }
                                            g.DrawImage(objPicBox.Image, objPicBox.Location.X, objPicBox.Location.Y, objPicBox.Width, objPicBox.Height);
                                        }
                                        else if (strInfo[0] == "uRectangle")
                                        {
                                            uRectangle objRec = new uRectangle();
                                            objRec.Size     = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                            objRec.Location = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));

                                            objRec.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));

                                            switch (strInfo[11].Trim())
                                            {
                                            case "None":
                                                objRec.RectangleBorderStyle = ButtonBorderStyle.None;
                                                break;

                                            case "Dotted":
                                                objRec.RectangleBorderStyle = ButtonBorderStyle.Dotted;
                                                break;

                                            case "Dashed":
                                                objRec.RectangleBorderStyle = ButtonBorderStyle.Dashed;
                                                break;

                                            case "Solid":
                                                objRec.RectangleBorderStyle = ButtonBorderStyle.Solid;
                                                break;

                                            case "Inset":
                                                objRec.RectangleBorderStyle = ButtonBorderStyle.Inset;
                                                break;

                                            case "Outset":
                                                objRec.RectangleBorderStyle = ButtonBorderStyle.Outset;
                                                break;
                                            }

                                            switch (strInfo[12].Trim())
                                            {
                                            case "None":
                                                objRec.BorderStyle = BorderStyle.Fixed3D;
                                                break;

                                            case "FixedSingle":
                                                objRec.BorderStyle = BorderStyle.FixedSingle;
                                                break;

                                            case "Fixed3D":
                                                objRec.BorderStyle = BorderStyle.Fixed3D;
                                                break;
                                            }
                                            objRec.BorderColor = Color.FromArgb(Convert.ToInt32(strInfo[13].Trim()));
                                        }
                                        else if (strInfo[0] == "Line")
                                        {
                                            Line objLable = new Line();
                                            if (strInfo[1] == "True")
                                            {
                                                objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                            }
                                            else
                                            {
                                                objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                            }

                                            objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                            objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                            objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                            objLable.Text      = strInfo[9];

                                            objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                            //obj.Controls.Add(objLable);
                                            //obj.Refresh();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.ComponentModel.Win32Exception ex)
            {
                clsUtility.ShowErrorMessage(ex.ToString());
            }
            catch (Exception ex)
            {
                clsUtility.ShowErrorMessage(ex.ToString());
            }
        }
        private void LoadTemplate(bool IsFromFile)
        {
            string strBarCodeSettingValue = "";

            if (IsFromFile)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    strBarCodeSettingValue = File.ReadAllText(openFileDialog.FileName);
                }
            }
            else
            {
                strBarCodeSettingValue = GetBarCodeSettings();
            }

            if (strBarCodeSettingValue != null)
            {
                string[] strfiles = strBarCodeSettingValue.Split('\n');

                if (strfiles.Length > 0)
                {
                    this.Controls.Remove(obj);
                    this.Invalidate();

                    //obj.Controls.Clear();
                    //    obj.Refresh();
                    AddNewPage();

                    if (strfiles.Length > 0)
                    {
                        for (int i = 0; i < strfiles.Length; i++)
                        {
                            string[] strInfo = strfiles[i].Split('@');

                            if (i == 0)
                            {
                                obj.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[0]));
                                obj.Size      = new Size(Convert.ToInt32(strInfo[1]), Convert.ToInt32(strInfo[2]));
                            }
                            else
                            { //Type-IsBold-Family-argb(int)-fsize(float)-w-h-x-y-text-backColor(int)-RecBorderStyle-borderStyle-borderColor
                                if (strInfo[0] == "Label")
                                {
                                    Label objLable = new Label();
                                    if (strInfo[1] == "True")
                                    {
                                        objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                    }
                                    else
                                    {
                                        objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                    }

                                    objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                    objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                    objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                    objLable.Text      = strInfo[9];

                                    objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                    objLable.Tag       = strInfo[14];

                                    try
                                    {
                                        // int to enum
                                        objLable.TextAlign = (ContentAlignment)Convert.ToInt32(strInfo[15]);
                                    }
                                    catch
                                    {
                                    }

                                    objLable.MouseEnter      += new EventHandler(obj.control_MouseEnter);
                                    objLable.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    objLable.MouseDown       += new MouseEventHandler(obj.control_MouseDown);
                                    objLable.MouseMove       += new MouseEventHandler(obj.control_MouseMove);
                                    objLable.MouseUp         += new MouseEventHandler(obj.control_MouseUp);
                                    objLable.Click           += obj.ctrl_Click;
                                    objLable.DoubleClick     += obj.ctrl_DoubleClick;
                                    objLable.ContextMenuStrip = contextMenuStrip1;
                                    objLable.Click           += new EventHandler(obj.ctrl_Click);
                                    objLable.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    obj.Controls.Add(objLable);
                                }
                                else if (strInfo[0] == "VerticalLabel")
                                {
                                    VerticalLabel objLable = new VerticalLabel();
                                    if (strInfo[1] == "True")
                                    {
                                        objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                    }
                                    else
                                    {
                                        objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                    }

                                    objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                    objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                    objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                    objLable.Text      = strInfo[9];

                                    objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                    objLable.Tag       = strInfo[14];

                                    objLable.MouseEnter      += new EventHandler(obj.control_MouseEnter);
                                    objLable.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    objLable.MouseDown       += new MouseEventHandler(obj.control_MouseDown);
                                    objLable.MouseMove       += new MouseEventHandler(obj.control_MouseMove);
                                    objLable.MouseUp         += new MouseEventHandler(obj.control_MouseUp);
                                    objLable.Click           += obj.ctrl_Click;
                                    objLable.DoubleClick     += obj.ctrl_DoubleClick;
                                    objLable.ContextMenuStrip = contextMenuStrip1;
                                    objLable.Click           += new EventHandler(obj.ctrl_Click);

                                    objLable.MouseLeave += new EventHandler(obj.control_MouseLeave);
                                    obj.Controls.Add(objLable);
                                }
                                else if (strInfo[0] == "PictureBox")
                                {
                                    PictureBox objPicBox = new PictureBox();

                                    objPicBox.Size             = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                    objPicBox.Location         = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                    objPicBox.BorderStyle      = BorderStyle.FixedSingle;
                                    objPicBox.MouseEnter      += new EventHandler(obj.control_MouseEnter);
                                    objPicBox.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    objPicBox.MouseDown       += new MouseEventHandler(obj.control_MouseDown);
                                    objPicBox.MouseMove       += new MouseEventHandler(obj.control_MouseMove);
                                    objPicBox.MouseUp         += new MouseEventHandler(obj.control_MouseUp);
                                    objPicBox.Click           += obj.ctrl_Click;
                                    objPicBox.DoubleClick     += obj.ctrl_DoubleClick;
                                    objPicBox.ContextMenuStrip = contextMenuStrip1;
                                    objPicBox.Click           += new EventHandler(obj.ctrl_Click);
                                    objPicBox.Image            = IMS_Client_2.Properties.Resources.barCode;
                                    objPicBox.SizeMode         = PictureBoxSizeMode.StretchImage;
                                    objPicBox.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    obj.Controls.Add(objPicBox);
                                }
                                else if (strInfo[0] == "uRectangle")
                                {
                                    uRectangle objRec = new uRectangle();
                                    objRec.Size     = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                    objRec.Location = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));

                                    objRec.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));

                                    switch (strInfo[11].Trim())
                                    {
                                    case "None":
                                        objRec.RectangleBorderStyle = ButtonBorderStyle.None;
                                        break;

                                    case "Dotted":
                                        objRec.RectangleBorderStyle = ButtonBorderStyle.Dotted;
                                        break;

                                    case "Dashed":
                                        objRec.RectangleBorderStyle = ButtonBorderStyle.Dashed;
                                        break;

                                    case "Solid":
                                        objRec.RectangleBorderStyle = ButtonBorderStyle.Solid;
                                        break;

                                    case "Inset":
                                        objRec.RectangleBorderStyle = ButtonBorderStyle.Inset;
                                        break;

                                    case "Outset":
                                        objRec.RectangleBorderStyle = ButtonBorderStyle.Outset;
                                        break;
                                    }

                                    switch (strInfo[12].Trim())
                                    {
                                    case "None":
                                        objRec.BorderStyle = BorderStyle.Fixed3D;
                                        break;

                                    case "FixedSingle":
                                        objRec.BorderStyle = BorderStyle.FixedSingle;
                                        break;

                                    case "Fixed3D":
                                        objRec.BorderStyle = BorderStyle.Fixed3D;
                                        break;
                                    }
                                    objRec.BorderColor = Color.FromArgb(Convert.ToInt32(strInfo[13].Trim()));

                                    objRec.MouseEnter      += new EventHandler(obj.control_MouseEnter);
                                    objRec.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    objRec.MouseDown       += new MouseEventHandler(obj.control_MouseDown);
                                    objRec.MouseMove       += new MouseEventHandler(obj.control_MouseMove);
                                    objRec.MouseUp         += new MouseEventHandler(obj.control_MouseUp);
                                    objRec.Click           += obj.ctrl_Click;
                                    objRec.DoubleClick     += obj.ctrl_DoubleClick;
                                    objRec.ContextMenuStrip = contextMenuStrip1;
                                    objRec.Click           += new EventHandler(obj.ctrl_Click);
                                    objRec.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    obj.Controls.Add(objRec);
                                }
                                else if (strInfo[0] == "Line")
                                {
                                    Line objLable = new Line();
                                    if (strInfo[1] == "True")
                                    {
                                        objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                    }
                                    else
                                    {
                                        objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                    }

                                    objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                    objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                    objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                    objLable.Text      = strInfo[9];

                                    objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));

                                    objLable.MouseEnter      += new EventHandler(obj.control_MouseEnter);
                                    objLable.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    objLable.MouseDown       += new MouseEventHandler(obj.control_MouseDown);
                                    objLable.MouseMove       += new MouseEventHandler(obj.control_MouseMove);
                                    objLable.MouseUp         += new MouseEventHandler(obj.control_MouseUp);
                                    objLable.Click           += obj.ctrl_Click;
                                    objLable.DoubleClick     += obj.ctrl_DoubleClick;
                                    objLable.ContextMenuStrip = contextMenuStrip1;
                                    objLable.Click           += new EventHandler(obj.ctrl_Click);
                                    objLable.MouseLeave      += new EventHandler(obj.control_MouseLeave);
                                    obj.Controls.Add(objLable);
                                }
                            }
                        }
                        this.Focus();
                        this.Activate();
                        //clsUtility.ShowInfoMessage("Template Loaded Successfully.", "Designer Tool");
                    }
                }
            }
        }
        private void Doc_PrintPage(object sender, PrintPageEventArgs e)
        {
            //Print image
            // Bitmap bm = new Bitmap(picBarCode.Image);

            e.Graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            e.Graphics.PixelOffsetMode    = PixelOffsetMode.Half;
            e.Graphics.SmoothingMode      = SmoothingMode.AntiAlias;
            e.Graphics.CompositingQuality = CompositingQuality.GammaCorrected;
            e.Graphics.CompositingMode    = CompositingMode.SourceCopy;

            //e.Graphics.DrawImage(bm, 0, 0);
            //bm.Dispose();

            using (Graphics g = e.Graphics)
            {
                string strBarCodeSettingValue = GetBarCodeSettings();
                if (strBarCodeSettingValue != null)
                {
                    string[] strfiles = strBarCodeSettingValue.Split('\n');

                    if (strfiles.Length > 0)
                    {
                        string ProductID = _PrintRowData.Cells["ProductID"].Value.ToString();
                        //obj.Controls.Clear();
                        //    obj.Refresh();
                        AddNewPage();

                        if (strfiles.Length > 0)
                        {
                            for (int i = 0; i < strfiles.Length; i++)
                            {
                                string[] strInfo = strfiles[i].Split('@');

                                if (i == 0)
                                {
                                    obj.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[0]));
                                    obj.Size      = new Size(Convert.ToInt32(strInfo[1]), Convert.ToInt32(strInfo[2]));
                                }
                                else
                                { //Type-IsBold-Family-argb(int)-fsize(float)-w-h-x-y-text-backColor(int)-RecBorderStyle-borderStyle-borderColor
                                    if (strInfo[0] == "Label")
                                    {
                                        Label objLable = new Label();
                                        if (strInfo[1] == "True")
                                        {
                                            objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                        }
                                        else
                                        {
                                            objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                        }

                                        objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                        objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                        objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                        objLable.Text      = strInfo[9];

                                        objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                        objLable.Tag       = strInfo[14];

                                        SetBarCodeValues(objLable, _PrintRowData);

                                        obj.Controls.Add(objLable);
                                        obj.Refresh();

                                        string caption3 = string.Format(objLable.Text);
                                        g.DrawString(caption3, objLable.Font, System.Drawing.Brushes.Black, objLable.Location.X, objLable.Location.Y);
                                    }
                                    else if (strInfo[0] == "VerticalLabel")
                                    {
                                        VerticalLabel objLable = new VerticalLabel();
                                        if (strInfo[1] == "True")
                                        {
                                            objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                        }
                                        else
                                        {
                                            objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                        }

                                        objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                        objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                        objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                        objLable.Text      = strInfo[9];

                                        objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                        objLable.Tag       = strInfo[14];

                                        SetBarCodeValues(objLable, _PrintRowData);

                                        objLable.MouseLeave += new EventHandler(obj.control_MouseLeave);
                                        obj.Controls.Add(objLable);
                                        obj.Refresh();

                                        string captionText   = objLable.Text;
                                        Size   preferredSize = g.MeasureString(objLable.Text, objLable.Font).ToSize();

                                        // change this value
                                        int padding = 20;

                                        DrawRotatedTextAt(g, -90, captionText,
                                                          objLable.Location.X, objLable.Location.Y + preferredSize.Width + padding, objLable.Font, Brushes.Black);
                                    }
                                    else if (strInfo[0] == "PictureBox")
                                    {
                                        PictureBox objPicBox = new PictureBox();

                                        objPicBox.Size        = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                        objPicBox.Location    = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                        objPicBox.BorderStyle = BorderStyle.FixedSingle;

                                        objPicBox.Image       = Barcode.clsBarCodeUtility.GenerateBarCode(_Current_BarCodeNumber);
                                        objPicBox.SizeMode    = PictureBoxSizeMode.StretchImage;
                                        objPicBox.MouseLeave += new EventHandler(obj.control_MouseLeave);
                                        obj.Controls.Add(objPicBox);

                                        g.DrawImage(objPicBox.Image, objPicBox.Location.X, objPicBox.Location.Y, objPicBox.Width, objPicBox.Height);
                                    }
                                    else if (strInfo[0] == "uRectangle")
                                    {
                                        uRectangle objRec = new uRectangle();
                                        objRec.Size     = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                        objRec.Location = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));

                                        objRec.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));

                                        switch (strInfo[11].Trim())
                                        {
                                        case "None":
                                            objRec.RectangleBorderStyle = ButtonBorderStyle.None;
                                            break;

                                        case "Dotted":
                                            objRec.RectangleBorderStyle = ButtonBorderStyle.Dotted;
                                            break;

                                        case "Dashed":
                                            objRec.RectangleBorderStyle = ButtonBorderStyle.Dashed;
                                            break;

                                        case "Solid":
                                            objRec.RectangleBorderStyle = ButtonBorderStyle.Solid;
                                            break;

                                        case "Inset":
                                            objRec.RectangleBorderStyle = ButtonBorderStyle.Inset;
                                            break;

                                        case "Outset":
                                            objRec.RectangleBorderStyle = ButtonBorderStyle.Outset;
                                            break;
                                        }

                                        switch (strInfo[12].Trim())
                                        {
                                        case "None":
                                            objRec.BorderStyle = BorderStyle.Fixed3D;
                                            break;

                                        case "FixedSingle":
                                            objRec.BorderStyle = BorderStyle.FixedSingle;
                                            break;

                                        case "Fixed3D":
                                            objRec.BorderStyle = BorderStyle.Fixed3D;
                                            break;
                                        }
                                        objRec.BorderColor = Color.FromArgb(Convert.ToInt32(strInfo[13].Trim()));

                                        objRec.MouseEnter  += new EventHandler(obj.control_MouseEnter);
                                        objRec.MouseLeave  += new EventHandler(obj.control_MouseLeave);
                                        objRec.MouseDown   += new MouseEventHandler(obj.control_MouseDown);
                                        objRec.MouseMove   += new MouseEventHandler(obj.control_MouseMove);
                                        objRec.MouseUp     += new MouseEventHandler(obj.control_MouseUp);
                                        objRec.Click       += obj.ctrl_Click;
                                        objRec.DoubleClick += obj.ctrl_DoubleClick;

                                        objRec.Click += new EventHandler(obj.ctrl_Click);

                                        objRec.MouseLeave += new EventHandler(obj.control_MouseLeave);
                                        obj.Controls.Add(objRec);
                                        obj.Refresh();
                                    }
                                    else if (strInfo[0] == "Line")
                                    {
                                        Line objLable = new Line();
                                        if (strInfo[1] == "True")
                                        {
                                            objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Bold);
                                        }
                                        else
                                        {
                                            objLable.Font = new Font(strInfo[2], float.Parse(strInfo[4]), FontStyle.Regular);
                                        }

                                        objLable.ForeColor = Color.FromArgb(Convert.ToInt32(strInfo[3]));
                                        objLable.Size      = new Size(Convert.ToInt32(strInfo[5]), Convert.ToInt32(strInfo[6]));
                                        objLable.Location  = new Point(Convert.ToInt32(strInfo[7]), Convert.ToInt32(strInfo[8]));
                                        objLable.Text      = strInfo[9];

                                        objLable.BackColor = Color.FromArgb(Convert.ToInt32(strInfo[10]));
                                        obj.Controls.Add(objLable);
                                        obj.Refresh();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }