[Mono-bugs] [Bug 82587][Cri] New - The character alignment fails.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Aug 25 01:11:46 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by krishna at globalmultimedia.in.

http://bugzilla.ximian.com/show_bug.cgi?id=82587

--- shadow/82587	2007-08-25 01:11:46.000000000 -0400
+++ shadow/82587.tmp.380	2007-08-25 01:11:46.000000000 -0400
@@ -0,0 +1,94 @@
+Bug#: 82587
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: Debian Lenny
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Critical
+Component: Sys.Drawing.
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: krishna at globalmultimedia.in               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: The character alignment fails.
+
+Description of Problem:
+
+The following code fails to put the text in the right place.  It works 
+correctly on VS2005.
+
+int[] colwidth = new int[5];
+int[] hlines = new int[8];
+
+private void Form1_Paint(object sender, PaintEventArgs e)
+		{
+			Graphics pDC = e.Graphics;
+			int YSpacing = e.ClipRectangle.Height / 9;
+			int width = e.ClipRectangle.Width;
+			for (int loc = 0; loc < 8; loc++)
+			{
+				hlines[loc] = YSpacing * (loc + 1);
+			}
+			colwidth[0] = (width * 107) / 1000;
+			colwidth[1] = colwidth[3] = (width * 8625) / 
+100000;
+			colwidth[2] = (width * 1275) / 10000;
+			colwidth[4] = (width * 594) / 1000;
+			DrawAll();
+		}
+
+private void DrawAll()
+		{
+			System.Drawing.Graphics pDC = this.CreateGraphics
+();
+			Pen pen = new Pen(Brushes.White, 2.0F);
+			int xloc = 0;
+			for (int tint = 0; tint < 4; tint++)
+			{
+				xloc += colwidth[tint];
+				pDC.DrawLine(pen, xloc, 0, xloc, 600);
+			}
+			foreach (int loc in hlines)
+			{
+				pDC.DrawLine(pen, 0, loc, 800, loc);
+			}
+			System.Drawing.Font font = new System.Drawing.Font
+("Arial Narrow", 39);
+			SolidBrush txtcolor = new SolidBrush(Color.White);
+			Rectangle rect = new Rectangle();
+			rect.Height = hlines[0] - 3;
+			rect.Y = 2;
+			rect.X = 2;
+			int col = 0;
+			string[] Header = new string[] 
+{ "CH", "Li", "Sl", "St", "CASE NO." };
+			SizeF strsize = new SizeF();
+			while (col < 5)
+			{
+				rect.Width = colwidth[col] - 3;
+				pDC.FillRectangle(Brushes.Blue, rect);
+				strsize = pDC.MeasureString(Header[col], 
+font);
+				int strwidth = Convert.ToInt32
+(strsize.Width);
+				int xshift = 0;
+				if (strwidth < rect.Width && col < 4)
+				{
+					xshift = (rect.Width - 
+strwidth) / 2;
+					rect.Width = strwidth + 1;
+					rect.X += xshift;
+				}
+				pDC.DrawString(Header[col], font, 
+txtcolor, rect);
+				rect.X += rect.Width + 3 + xshift;
+				col++;
+			}
+			txtcolor.Dispose();
+			pDC.Dispose();
+			font.Dispose();
+		};


More information about the mono-bugs mailing list