[mapguide-commits] r6421 - trunk/Tools/Maestro/Maestro.Editors/Common

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jan 12 05:52:17 EST 2012


Author: jng
Date: 2012-01-12 02:52:17 -0800 (Thu, 12 Jan 2012)
New Revision: 6421

Modified:
   trunk/Tools/Maestro/Maestro.Editors/Common/ImageStylePicker.cs
Log:
#585: Fix line style offsets. The cause was rendering the images to the graphics context as a TextureBrush, which probably applied some strange offsets to the image to be rendered. This call has been replaced with a direct DrawImage call instead.

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ImageStylePicker.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ImageStylePicker.cs	2012-01-12 09:47:08 UTC (rev 6420)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ImageStylePicker.cs	2012-01-12 10:52:17 UTC (rev 6421)
@@ -100,12 +100,15 @@
 
 			Color brushcolor = this.Enabled ? this.ForeColor : System.Drawing.SystemColors.GrayText; 
 			int imageWidth = e.Bounds.Width - m_textWidth - MARGIN * 2;
+
+            int startX = e.Bounds.X + MARGIN;
+            int startY = e.Bounds.Y + MARGIN;
+
 			//TODO: Apply B/W + dim filter here
-			Rectangle r = new Rectangle(e.Bounds.X + MARGIN + 1, e.Bounds.Y + MARGIN + 1, imageWidth - 1, m_itemHeight - 1);
-			using (Brush b = new TextureBrush(bmp))
-				e.Graphics.FillRectangle(b, r);
-			
-			r = new Rectangle(e.Bounds.X + MARGIN, e.Bounds.Y + MARGIN, imageWidth, m_itemHeight);
+            Rectangle r = new Rectangle(startX + 1, startY + 1, imageWidth - 1, m_itemHeight - 1);
+            e.Graphics.DrawImageUnscaledAndClipped(bmp, r);
+
+            r = new Rectangle(startX, startY, imageWidth, m_itemHeight);
 			using(Pen p = new Pen(brushcolor))
 				e.Graphics.DrawRectangle(p, r);
 



More information about the mapguide-commits mailing list