FastReport

Форк
0
105 строк · 3.5 Кб
1
using System;
2
using System.Collections;
3
using System.Drawing;
4
using System.ComponentModel;
5
using FastReport.Utils;
6

7
namespace FastReport
8
{
9
    /// <summary>
10
    /// This class represents a child band.
11
    /// </summary>
12
    /// <remarks>
13
    /// Typical use of child band is to print several objects that can grow or shrink. It also can be done
14
    /// using the shift feature (via <see cref="ShiftMode"/> property), but in some cases it's not possible.
15
    /// </remarks>
16
    public partial class ChildBand : BandBase
17
    {
18
        private bool fillUnusedSpace;
19
        private int completeToNRows;
20
        private bool printIfDatabandEmpty;
21

22
        /// <summary>
23
        /// Gets or sets a value indicating that band will be used to fill unused space on a page.
24
        /// </summary>
25
        /// <remarks>
26
        /// If you set this property to <b>true</b>, the band will be printed several times to fill 
27
        /// unused space on a report page.
28
        /// </remarks>
29
        [Category("Behavior")]
30
        [DefaultValue(false)]
31
        public bool FillUnusedSpace
32
        {
33
            get { return fillUnusedSpace; }
34
            set { fillUnusedSpace = value; }
35
        }
36

37
        /// <summary>
38
        /// Gets or sets a value that determines the overall number of data rows printed by the data band.
39
        /// </summary>
40
        /// <remarks>
41
        /// Using this property, you may complete the data band upto N data rows.
42
        /// If the data band has less number of rows, this band will be used to print empty rows.
43
        /// </remarks>
44
        [Category("Behavior")]
45
        [DefaultValue(0)]
46
        public int CompleteToNRows
47
        {
48
            get { return completeToNRows; }
49
            set { completeToNRows = value; }
50
        }
51

52
        /// <summary>
53
        /// Gets or sets a value indicating that the band will be printed if its parent databand is empty.
54
        /// </summary>
55
        /// <remarks>
56
        /// The child band with this property set to true, connected to a databand can be used to print "No data" 
57
        /// text if the databand has no rows.
58
        /// </remarks>
59
        [Category("Behavior")]
60
        [DefaultValue(false)]
61
        public bool PrintIfDatabandEmpty
62
        {
63
            get { return printIfDatabandEmpty; }
64
            set { printIfDatabandEmpty = value; }
65
        }
66

67
        internal BandBase GetTopParentBand
68
        {
69
            get
70
            {
71
                BandBase band = this;
72
                while (band is ChildBand)
73
                {
74
                    band = band.Parent as BandBase;
75
                }
76

77
                return band;
78
            }
79
        }
80

81
        /// <inheritdoc/>
82
        public override void Assign(Base source)
83
        {
84
            base.Assign(source);
85
            ChildBand src = source as ChildBand;
86
            FillUnusedSpace = src.FillUnusedSpace;
87
            CompleteToNRows = src.CompleteToNRows;
88
            PrintIfDatabandEmpty = src.PrintIfDatabandEmpty;
89
        }
90

91
        /// <inheritdoc/>
92
        public override void Serialize(FRWriter writer)
93
        {
94
            ChildBand c = writer.DiffObject as ChildBand;
95
            base.Serialize(writer);
96

97
            if (FillUnusedSpace != c.FillUnusedSpace)
98
                writer.WriteBool("FillUnusedSpace", FillUnusedSpace);
99
            if (CompleteToNRows != c.CompleteToNRows)
100
                writer.WriteInt("CompleteToNRows", CompleteToNRows);
101
            if (PrintIfDatabandEmpty != c.PrintIfDatabandEmpty)
102
                writer.WriteBool("PrintIfDatabandEmpty", PrintIfDatabandEmpty);
103
        }
104
    }
105
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.