12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Windows.Forms;
- using System.Drawing;
- using FastReport.Utils;
- using System.ComponentModel;
- namespace FastReport.Controls
- {
- internal class BandComboBox : ComboBox
- {
- protected override void OnDrawItem(DrawItemEventArgs e)
- {
- e.DrawBackground();
- if (e.Index >= 0)
- {
- BandBase c = Items[e.Index] as BandBase;
- Image img = this.GetImage(c == null ? 76 : RegisteredObjects.FindObject(c).ImageIndex);
- string text = "";
- if (c == null)
- text = Res.Get("Misc,None");
- else
- {
- text = c.Name;
- if (c is DataBand)
- text += ": " + c.GetInfoText();
- else if (c is DataFooterBand)
- text += ": " + c.DataBand.GetInfoText();
- else if (c is GroupFooterBand)
- text += ": " + (c.Parent as GroupHeaderBand).GetInfoText();
- }
- this.DrawImageAndText(e, img, text);
- }
- }
- public BandComboBox()
- {
- DrawMode = DrawMode.OwnerDrawFixed;
- }
- }
- }
|