<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GDI+ Smooth Edge Draw Issue in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438859#M11903</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: kirkktx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your implementation of ILayer.Draw, try commenting out the startdrawing and finishdrawing calls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the map calls these methods before/after calling ILayer.Draw.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Jul 2010 13:34:22 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2010-07-20T13:34:22Z</dc:date>
    <item>
      <title>GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438850#M11894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: dberry911&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using VS2005 VB.NET with ArcObjects V9.3.1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using GDI+ to DrawImage, DrawString, DrawEllipse as part of an AVL Tracking Layer(non-dynamic map).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Resulting images, text, and ellipsis are not drawn smooth, they appear as having rough edges.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the same code in a test application results in all images &amp;amp; text with smooth edges.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The GDI+ MeasureString method calculates inaccurate values, but in the test application calculations are correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When DrawText is used with a background the text has smooth edges, but if drawn directly on the MapControl the text has rough edges.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am setting the SmoothingMode of the graphics to Antialias and have tried every other combination without success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Attached are examples of rough &amp;amp; smooth edges of an ellipse.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone else see this same issue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Suggestions &amp;amp; insights appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jul 2010 16:37:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438850#M11894</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-07-11T16:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438851#M11895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: kirkktx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Post your code showing how you are calling GDI+.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jul 2010 14:26:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438851#M11895</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-07-12T14:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438852#M11896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kirk,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In essence here is the code that I use to draw a circle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim sdpPen As Pen&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdpPen = New Pen(Brushes.Yellow)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdpPen.Width = 10.0F&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Graphics.DrawEllipse(sdpPen, New Rectangle(200, 100, 80, 80))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdpPen.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's really pretty simple.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See what you think,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jul 2010 00:12:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438852#M11896</guid>
      <dc:creator>DennisBerry</dc:creator>
      <dc:date>2010-07-14T00:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438853#M11897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: kirkktx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code below works for me, clicking on the mapcontrol toggles antialiasing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private SmoothingMode m_mode = SmoothingMode.AntiAlias;
public MapForm1()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();
}

private void axMapControl1_OnAfterScreenDraw(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnAfterScreenDrawEvent e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphics g = Graphics.FromHdc(new IntPtr(e.hdc));
&amp;nbsp;&amp;nbsp;&amp;nbsp; DrawEllipse(g);
&amp;nbsp;&amp;nbsp;&amp;nbsp; g.Dispose();
}
private void DrawEllipse(Graphics g)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; g.SmoothingMode = m_mode;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Pen sdPen = new Pen(Brushes.Red, (float)10.0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawEllipse(sdPen, new Rectangle(100, 100, 200, 200));
&amp;nbsp;&amp;nbsp;&amp;nbsp; sdPen.Dispose();
}

private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (m_mode == SmoothingMode.AntiAlias)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_mode = SmoothingMode.HighSpeed;
&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_mode = SmoothingMode.AntiAlias;
&amp;nbsp;&amp;nbsp;&amp;nbsp; axMapControl1.Refresh();
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:37:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438853#M11897</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T19:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438854#M11898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kirk,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code I use is the same as the example you provided, but as you can see by the attached picture that drawn according to your example are smooth and mine is rough.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The difference is that your example draws in the MapControl's OnAfterScreenDraw, whereas I am doing mine in the Draw Event of a custom IMarkerSymbol Class, which inherits ISymbol, that is invoked from the Draw Event of an inherited CustomBaseLayer that inherits ILayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wonder if there is some property that needs to be set somewhere along the way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 02:20:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438854#M11898</guid>
      <dc:creator>DennisBerry</dc:creator>
      <dc:date>2010-07-15T02:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438855#M11899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: kirkktx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you try setting ILayer.Cached = true for your custom layer before adding it to the map?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 17:11:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438855#M11899</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-07-15T17:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438856#M11900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I set Cached=True prior to adding the layer to the MapControl.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems to me there is something about the layer that interferes with GDI+.&amp;nbsp; Everything that is drawn on it has rough edges, including icons and text.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just applied 9.3.1 SP2, but that had no effect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anything else you might suggest?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jul 2010 00:42:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438856#M11900</guid>
      <dc:creator>DennisBerry</dc:creator>
      <dc:date>2010-07-16T00:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438857#M11901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: kirkktx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How are you creating your graphics object?&amp;nbsp; Are you creating it from the hDC passed to ILayer.Draw?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Jul 2010 16:03:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438857#M11901</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-07-19T16:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438858#M11902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My ILayer.Draw has the following basic logic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Display.StartDrawing(Display.hDC, CShort(ESRI.ArcGIS.Display.esriScreenCache.esriAllScreenCaches))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For Each Item to Draw&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Display.SetSymbol(MyCustomIMarker)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Display.DrawPoint(MyPoint)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Display.FinishDrawing()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Draw is not done here but in the CustomMarker Class.&amp;nbsp; The SetupDC Event is passed the hDC from which the Graphics Object is created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub SetupDC(ByVal hdc As Integer, ByVal aoDisplayTrans As ESRI.ArcGIS.Geometry.ITransformation) Implements ESRI.ArcGIS.Display.ISymbol.SetupDC&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' create graphics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myGraphics = Graphics.FromHdc(hdc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myGraphics.SmoothingMode = SmoothingMode.AntiAlias&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myGraphics.InterpolationMode = InterpolationMode.HighQualityBilinear&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The IMarker.Draw Event then uses the above Graphics Object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't matter where along the event path the drawing is done they all appear with rough edges as well as labels that have rough edges.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jul 2010 10:37:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438858#M11902</guid>
      <dc:creator>DennisBerry</dc:creator>
      <dc:date>2010-07-20T10:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438859#M11903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: kirkktx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your implementation of ILayer.Draw, try commenting out the startdrawing and finishdrawing calls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the map calls these methods before/after calling ILayer.Draw.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:34:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438859#M11903</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-07-20T13:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: GDI+ Smooth Edge Draw Issue</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438860#M11904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kirk,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had tried once before commenting-out the start/finish draw to no affect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This logic is all pretty simple and it's my feeling that there is some type of underlying issue, but what that is I have no idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone from ESRI have any suggestions to offer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And again it doesn't matter where I do the draw it all results in rough edges.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jul 2010 01:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdi-smooth-edge-draw-issue/m-p/438860#M11904</guid>
      <dc:creator>DennisBerry</dc:creator>
      <dc:date>2010-07-21T01:00:33Z</dc:date>
    </item>
  </channel>
</rss>

