private void saveTemplateToolStripMenuItem_Click(object sender, EventArgs e) { if (clsFormRights.HasFormRight(clsFormRights.Forms.frmBarCodeDesigner, clsFormRights.Operation.Save) || clsUtility.IsAdmin) { if (obj == null) { clsUtility.ShowInfoMessage("Please design your barcode.", clsUtility.strProjectTitle); return; } strTemplate = ""; //Type-IsBold-Family-argb(int)-fsize(float)-w-h-x-y-text-backColor(int)-RecBorderStyle-borderStyle-borderColor WriteToLog(obj.BackColor.ToArgb().ToString() + "@" + obj.Size.Width + "@" + obj.Size.Height); for (int i = 0; i < obj.Controls.Count; i++) { // if control is not visible then don't save. if (!obj.Controls[i].Visible) { continue; } string type = obj.Controls[i].GetType().Name; bool b = obj.Controls[i].Font.Bold; string family = obj.Controls[i].Font.FontFamily.Name; int arbg = obj.Controls[i].ForeColor.ToArgb(); float fsize = obj.Controls[i].Font.Size; int w = obj.Controls[i].Size.Width; int h = obj.Controls[i].Size.Height; int x = obj.Controls[i].Location.X; int y = obj.Controls[i].Location.Y; string strtag = ""; if (obj.Controls[i].Tag != null) { strtag = obj.Controls[i].Tag.ToString(); } string text = obj.Controls[i].Text; int backColor = obj.Controls[i].BackColor.ToArgb(); string RecBorderStyle = ""; string borderStyle = ""; int borderColor = 0; int textAlightment = 0; if (obj.Controls[i].GetType() == typeof(Label)) { textAlightment = (int)((Label)(obj.Controls[i])).TextAlign; } if (obj.Controls[i].GetType() == typeof(uRectangle)) { uRectangle rc = (uRectangle)obj.Controls[i]; RecBorderStyle = rc.RectangleBorderStyle.ToString(); borderStyle = rc.BorderStyle.ToString(); borderColor = rc.BorderColor.ToArgb(); } WriteToLog(type + "@" + b + "@" + family + "@" + arbg + "@" + fsize + "@" + w + "@" + h + "@" + x + "@" + y + "@" + text + "@" + backColor + "@" + RecBorderStyle + "@" + borderStyle + "@" + borderColor + "@" + strtag + "@" + textAlightment); } SaveBarCodeSettings(strTemplate); clsUtility.ShowInfoMessage("Barcode Template has been saved.", CoreApp.clsUtility.strProjectTitle); } }
private void exportAsFileToolStripMenuItem_Click(object sender, EventArgs e) { if (clsFormRights.HasFormRight(clsFormRights.Forms.frmBarCodeDesigner, clsFormRights.Operation.Save) || clsUtility.IsAdmin) { strTemplate = ""; //Type-IsBold-Family-argb(int)-fsize(float)-w-h-x-y-text-backColor(int)-RecBorderStyle-borderStyle-borderColor WriteToLog(obj.BackColor.ToArgb().ToString() + "@" + obj.Size.Width + "@" + obj.Size.Height); for (int i = 0; i < obj.Controls.Count; i++) { string type = obj.Controls[i].GetType().Name; bool b = obj.Controls[i].Font.Bold; string family = obj.Controls[i].Font.FontFamily.Name; int arbg = obj.Controls[i].ForeColor.ToArgb(); float fsize = obj.Controls[i].Font.Size; int w = obj.Controls[i].Size.Width; int h = obj.Controls[i].Size.Height; int x = obj.Controls[i].Location.X; int y = obj.Controls[i].Location.Y; string strtag = ""; if (obj.Controls[i].Tag != null) { strtag = obj.Controls[i].Tag.ToString(); } string text = obj.Controls[i].Text; int backColor = obj.Controls[i].BackColor.ToArgb(); string RecBorderStyle = ""; string borderStyle = ""; int borderColor = 0; if (obj.Controls[i].GetType() == typeof(uRectangle)) { uRectangle rc = (uRectangle)obj.Controls[i]; RecBorderStyle = rc.RectangleBorderStyle.ToString(); borderStyle = rc.BorderStyle.ToString(); borderColor = rc.BorderColor.ToArgb(); } WriteToLog(type + "@" + b + "@" + family + "@" + arbg + "@" + fsize + "@" + w + "@" + h + "@" + x + "@" + y + "@" + text + "@" + backColor + "@" + RecBorderStyle + "@" + borderStyle + "@" + borderColor + "@" + strtag); } SaveFileDialog Obj = new SaveFileDialog(); Obj.Filter = ".dat Data File (*.dat)|*.dat|All files (*.*)|*.*"; Obj.FileName = "Template 01"; if (Obj.ShowDialog() == System.Windows.Forms.DialogResult.OK) { StreamWriter sw = new StreamWriter(Obj.FileName); sw.WriteLine(strTemplate); sw.Close(); clsUtility.ShowInfoMessage("Template Saved Successfully.", "Designer Tool"); } } }
public void AddRectangle(ContextMenuStrip cntx, PropertyGrid p) { PG = p; uRectangle ctrl = new uRectangle(); ctrl.Location = new Point(50, 50); ctrl.MouseEnter += new EventHandler(control_MouseEnter); ctrl.MouseLeave += new EventHandler(control_MouseLeave); ctrl.MouseDown += new MouseEventHandler(control_MouseDown); ctrl.MouseMove += new MouseEventHandler(control_MouseMove); ctrl.MouseUp += new MouseEventHandler(control_MouseUp); ctrl.Click += ctrl_Click; ctrl.ContextMenuStrip = cntx; this.Controls.Add(ctrl); ctrl.BringToFront(); }
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) { 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 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(); } } } } } } } }