Drawing Labels

May 10, 2011 at 3:28 PM

Hi, I'm programming a GIS application in C# and I have problems to add drawing labels since I use mapwingis 4.8.2.

I draw points with the Axmap.drawPoint method and lines with axmap.drawline, but I don't know how to display labels.

I tried with the following code but it doesn't work. Thank you for your help.

S.

 

  int   dr = map.NewDrawing(tkDrawReferenceList.dlSpatiallyReferencedList);
               Labels lbls = this.map.get_DrawingLabels(dr);
                                                     
                     map.DrawPoint((double)orders[0].X, (double)orders[0].Y, 5, (UInt32)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Green));
                    lbls.UseGdiPlus = true;
                     if (orders.Count >= 2)
                    {


                        for (int j = 1; j <= orders.Count - 1; j++)
                        {
                            map.DrawLine((double)orders[j].X, (double)orders[j].Y, (double)orders[j - 1].X, orders[j - 1].Y, 2, (UInt32)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Gray));
                            
                            if (orders.Count >= 3)
                            {
                                for (int k = 1; k < orders.Count - 1; k++)
                                {
                                    map.DrawPoint((double)orders[k].X, (double)orders[k].Y, 5, (UInt32)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Yellow));
                                    lbls.AddLabel("blabla", (double)orders[k].X, (double)orders[k].Y);
                                    
                                }
                            }
                                                  
                        }
                       
                        map.DrawPoint((double)orders[orders.Count - 1].X, (double)orders[orders.Count - 1].Y, 5, (UInt32)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red));
                        lbls.AddLabel("blabla", (double)orders[orders.Count - 1].X, (double)orders[orders.Count - 1].Y);
                                            
 
                    }
                                          
                    map.set_DrawingLabelsVisible(dr,true);
                    map.set_DrawingLabels(dr, lbls);