Example #1
0
 /// <summary>
 /// This method is used to draw the customization of leaf item.
 /// </summary>
 /// <param name="sender">This is object of treemap control.</param>
 /// <param name="e">This is event args parameter.</param>
 private void TreeMap1_LeafItemDrawing(object sender, LeafItemDrawingEventArgs e)
 {
     e.Cancel = true;
     if (e.Graphics != null && e.Cancel)
     {
         e.Graphics.FillRectangle((e.Color), e.RectSize);
         e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.White), 1), e.RectSize);
         e.Graphics.DrawString(e.Label, new Font("Segoe UI", 11), new SolidBrush(Color.White), e.RectSize.X, e.RectSize.Y);
     }
 }
Example #2
0
        void treeMap_LeafItemDrawing(object sender, LeafItemDrawingEventArgs e)
        {
            e.Cancel = true;
            if (e.Graphics != null && e.Cancel)
            {
                e.Graphics.FillRectangle((e.Color), e.RectSize);
                e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.White), 5), e.RectSize);
                e.Graphics.DrawString(e.Label, new Font("Segoe UI", (float)12), new SolidBrush(Color.White), e.RectSize.X, e.RectSize.Y);

                Image image = (e.Data as OlympicMedals).GameImage;

                if (image != null)
                {
                    e.Graphics.DrawImage(image, new Point(e.RectSize.X + (e.RectSize.Width / 2) - image.Width / 2, e.RectSize.Y + (e.RectSize.Height / 2) - image.Height / 2));
                }
            }
        }