ChildBandMenu.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using FastReport.Design;
  6. using FastReport.Utils;
  7. using System.Drawing;
  8. namespace FastReport
  9. {
  10. internal class ChildBandMenu : BandBaseMenu
  11. {
  12. public ContextMenuItem miFillUnusedSpace;
  13. private void miFillUnusedSpace_Click(object sender, EventArgs e)
  14. {
  15. foreach (Base c in Designer.SelectedObjects)
  16. {
  17. if (c is ChildBand && !c.HasRestriction(Restrictions.DontModify))
  18. (c as ChildBand).FillUnusedSpace = miFillUnusedSpace.Checked;
  19. }
  20. Change();
  21. }
  22. /* private void ud_ValueChanged(object sender, EventArgs e)
  23. {
  24. foreach (Base c in Designer.SelectedObjects)
  25. {
  26. if (c is ChildBand && !c.HasRestriction(Restrictions.DontModify))
  27. (c as ChildBand).CompleteToNRows = (int)(sender as NumericUpDown).Value;
  28. }
  29. Change();
  30. }*/
  31. public ChildBandMenu(Designer designer)
  32. : base(designer)
  33. {
  34. miFillUnusedSpace = CreateMenuItem(Res.Get("ComponentMenu,ChildBand,FillUnusedSpace"), new EventHandler(miFillUnusedSpace_Click));
  35. miFillUnusedSpace.BeginGroup = true;
  36. miFillUnusedSpace.CheckOnClick = true;
  37. miStartNewPage.BeginGroup = false;
  38. int insertPos = Items.IndexOf(miStartNewPage);
  39. Items.Insert(insertPos, miFillUnusedSpace);
  40. /* ChildBand childBand = Designer.SelectedObjects[0] as ChildBand;
  41. if (childBand.Parent is DataBand)
  42. {
  43. Panel panel = new Panel();
  44. panel.BackColor = Color.Transparent;
  45. panel.Padding = new System.Windows.Forms.Padding(6,0,0,0);
  46. Label label1 = new Label();
  47. label1.Text = Res.Get("ComponentMenu,ChildBand,CompleteToNRows");
  48. label1.AutoSize = true;
  49. label1.Parent = panel;
  50. int width = label1.Width + 8;
  51. label1.AutoSize = false;
  52. label1.Width = width;
  53. label1.Dock = DockStyle.Left;
  54. label1.TextAlign = ContentAlignment.MiddleLeft;
  55. NumericUpDown ud = new NumericUpDown();
  56. ud.Parent = panel;
  57. ud.Left = width + 6;
  58. ud.Top = 2;
  59. ud.Width = 50;
  60. ud.Value = childBand.CompleteToNRows;
  61. ud.ValueChanged += new EventHandler(ud_ValueChanged);
  62. panel.Width = ud.Right + 8;
  63. panel.Height = ud.Height + 4;
  64. ControlContainerItem host = new ControlContainerItem();
  65. host.Control = panel;
  66. Items.Insert(insertPos + 1, host);
  67. }*/
  68. ChildBand band = Designer.SelectedObjects[0] as ChildBand;
  69. miFillUnusedSpace.Enabled = !band.HasRestriction(Restrictions.DontModify);
  70. miFillUnusedSpace.Checked = band.FillUnusedSpace;
  71. }
  72. }
  73. }