Exemplo n.º 1
0
        private void dataLabelBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            if (dataLabelBox.Items.Count > 0)
            {
                DataLabel    ds        = (DataLabel)dataLabelBox.Items[e.Index];
                Brush        itemBrush = Brushes.Black;
                StringFormat sf        = new StringFormat();
                sf.Alignment     = StringAlignment.Near;
                sf.LineAlignment = StringAlignment.Center;
                switch (ds.DSectionType)
                {
                case DataSectionType.Image:
                    itemBrush = Brushes.DeepPink;
                    break;

                default:
                    break;
                }
                e.Graphics.DrawString(ds.ToString(), e.Font, itemBrush, dataLabelBox.GetItemRectangle(e.Index), sf);
            }
            e.DrawFocusRectangle();
        }