BandComboBox.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Windows.Forms;
  2. using System.Drawing;
  3. using FastReport.Utils;
  4. using System.ComponentModel;
  5. namespace FastReport.Controls
  6. {
  7. internal class BandComboBox : ComboBox
  8. {
  9. protected override void OnDrawItem(DrawItemEventArgs e)
  10. {
  11. e.DrawBackground();
  12. if (e.Index >= 0)
  13. {
  14. BandBase c = Items[e.Index] as BandBase;
  15. Image img = this.GetImage(c == null ? 76 : RegisteredObjects.FindObject(c).ImageIndex);
  16. string text = "";
  17. if (c == null)
  18. text = Res.Get("Misc,None");
  19. else
  20. {
  21. text = c.Name;
  22. if (c is DataBand)
  23. text += ": " + c.GetInfoText();
  24. else if (c is DataFooterBand)
  25. text += ": " + c.DataBand.GetInfoText();
  26. else if (c is GroupFooterBand)
  27. text += ": " + (c.Parent as GroupHeaderBand).GetInfoText();
  28. }
  29. this.DrawImageAndText(e, img, text);
  30. }
  31. }
  32. public BandComboBox()
  33. {
  34. DrawMode = DrawMode.OwnerDrawFixed;
  35. }
  36. }
  37. }