Exemplo n.º 1
0
        /// <summary>
        /// Used to print a LifeEvent
        /// </summary>
        /// <param name="mSettings"></param>
        /// <param name="currY"></param>
        /// <returns></returns>
        public float Print(PrintSettings mSettings, float currY)
        {
            // Birth
            String tmp;

            switch (eventType)
            {
                case LifeEventTypes.Birth:
                    tmp = "Birth:";
                    break;
                case LifeEventTypes.Death:
                    tmp = "Death:";
                    break;
                case LifeEventTypes.Marriage:
                    tmp = "Marriage:";
                    break;
                default:
                    tmp = "";
                    break;
            }

            mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Bold], Brushes.Black, mSettings.X, currY);

            if (!(date == "" && place == ""))
            {
                tmp = date + ", " + place;
                mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Regular], Brushes.Black, mSettings.tab1, currY);
            }

            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Bold].Height + mSettings.yMargin;

            if (note == "")
            {
                // Nothing more to print
                return currY;
            }

            // Print the notes text with a header and rectangle filled with text
            mSettings.graphics.DrawString("Notes", mSettings.font[(int)PrintSettings.Fonts.Bold], Brushes.Black, mSettings.tab1, currY);
            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Bold].Height + mSettings.yMargin;

            // See how wide the rectangle can be.
            SizeF size = mSettings.graphics.MeasureString(note, mSettings.font[(int)PrintSettings.Fonts.Regular]);
            float width = mSettings.Width - mSettings.tab1 - mSettings.X;
            RectangleF rect = new RectangleF(mSettings.tab1, currY, width, size.Height);
            mSettings.graphics.DrawString(note, mSettings.font[(int)PrintSettings.Fonts.Regular], Brushes.Black, new PointF(mSettings.tab1, currY));
            mSettings.graphics.DrawRectangle(Pens.Transparent, Rectangle.Round(rect));

            currY += size.Height + mSettings.yMargin;

            return currY;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Used to print a person.
        /// </summary>
        /// <param name="mSettings"></param>
        /// <param name="ev"></param>
        /// <param name="db"></param>
        public void Print(PrintSettings mSettings, PrintPageEventArgs ev, TorpgenDB db)
        {
            String tmp = "";
            float currY = mSettings.Y;
            float x = mSettings.X;

            // Name
            tmp = firstName + " " + lastName;

            mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Header1], Brushes.Black, x, currY);
            currY += mSettings.yMargin;

            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Header1].Height + mSettings.yMargin;

            // Separator
            PersonPrint.Instance.DrawSeparator(x, ev.PageBounds.Width - x, currY);
            currY += mSettings.yMargin;

            // Birth
            currY = birth.Print(mSettings, currY);
            // Death
            currY = death.Print(mSettings, currY);

            // Families (Marriages)

            currY += 40;
            mSettings.graphics.DrawString("Relationships", mSettings.font[(int)PrintSettings.Fonts.Header2], Brushes.Black, x, currY);
            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Header2].Height + mSettings.yMargin;
            // Separator
            PersonPrint.Instance.DrawSeparator(x, ev.PageBounds.Width - x, currY);
            currY += mSettings.yMargin;

            for (int i = 0; i < marriages.Count; i++)
            {
                bool useWife = (gender == Gender.Male) ? true : false;
                Marriage m = db.GetMarriage(marriages[i]);
                currY = m.Print(mSettings, currY, useWife, ev, db);
            }

            // Notes
            currY += 40;
            mSettings.graphics.DrawString("Notes", mSettings.font[(int)PrintSettings.Fonts.Header2], Brushes.Black, x, currY);
            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Header2].Height + (2 * mSettings.yMargin);
            // Separator
            PersonPrint.Instance.DrawSeparator(x, ev.PageBounds.Width - x, currY);
            currY += mSettings.yMargin;

            // See how wide the rectangle can be.
            SizeF size = mSettings.graphics.MeasureString(notes, mSettings.font[(int)PrintSettings.Fonts.Regular]);
            float width = mSettings.Width - mSettings.X - mSettings.X;
            RectangleF rect = new RectangleF(mSettings.X, currY, width, size.Height);
            mSettings.graphics.DrawString(notes, mSettings.font[(int)PrintSettings.Fonts.Regular], Brushes.Black, new PointF(mSettings.X, currY));
            mSettings.graphics.DrawRectangle(Pens.Transparent, Rectangle.Round(rect));

            currY += size.Height + mSettings.yMargin;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Prints marriage information.
        /// </summary>
        /// <param name="mSettings">Printing settings</param>
        /// <param name="currY">Current Y coordinate value</param>
        /// <param name="useWife">Flag if it is the wife part that should be printed</param>
        public float Print(PrintSettings mSettings, float currY, bool useWife, PrintPageEventArgs ev, TorpgenDB db)
        {
            var spouse = db.GetPerson(useWife ? wife : husband);
            float x = mSettings.X;

            if (spouse == null)
            {
                return currY;
            }

            string tmp = spouse.firstName + " " + spouse.lastName + " (" + spouse.birth.ToString() + "). ";

            mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Regular], Brushes.Black, PersonPrint.CurrentPrintSettings.tab0, currY);
            currY += mSettings.yMargin;
            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Regular].Height + mSettings.yMargin;

            tmp = "Married: " + info.date + ", " + info.place;
            mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Regular], Brushes.Black, PersonPrint.CurrentPrintSettings.tab1, currY);
            currY += mSettings.yMargin;
            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Regular].Height + mSettings.yMargin;

            tmp = "Children";
            mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Bold], Brushes.Black, PersonPrint.CurrentPrintSettings.tab1, currY);
            currY += mSettings.yMargin;
            currY += mSettings.fontSize[(int)PrintSettings.Fonts.Regular].Height + mSettings.yMargin;

            // Print all children these two persons have together.
            List<Person> kids = db.GetChildren(husband, wife);

            foreach (var k in kids)
            {
                tmp = k.firstName + " " + k.lastName + " (" + k.birth + ")";

                mSettings.graphics.DrawString(tmp, mSettings.font[(int)PrintSettings.Fonts.Regular], Brushes.Black, PersonPrint.CurrentPrintSettings.tab2, currY);
                currY += mSettings.yMargin;
                currY += mSettings.fontSize[(int)PrintSettings.Fonts.Regular].Height + mSettings.yMargin;
            }

            return currY;
        }