示例#1
0
 private void drawLegend()
 {
     if (!gdef.onlyGraph && !gdef.noLegend)
     {
         //int ascent = (int) worker.getFontAscent(gdef.smallFont);
         int height = (int)worker.getFontHeight(gdef.smallFont);
         foreach (CommentText c in gdef.comments)
         {
             if (c.isValidGraphElement())
             {
                 int x = c.x, y = c.y + height;
                 if (c.GetType() == typeof(LegendText))
                 {
                     // draw with BOX
                     int box      = (int)getBox();
                     int boxSpace = (int)(getBoxSpace());
                     worker.fillRect(x, y - box, box, box, gdef.colors[COLOR_FRAME]);
                     worker.fillRect(x + 1, y - box + 1, box - 2, box - 2, ((LegendText)c).legendColor);
                     worker.drawString(c.resolvedText, c.x + boxSpace, c.y, gdef.smallFont, gdef.colors[COLOR_FONT]);
                 }
                 else
                 {
                     worker.drawString(c.resolvedText, x, y - height, gdef.smallFont, gdef.colors[COLOR_FONT]);
                 }
             }
         }
     }
 }