Exemple #1
0
        private void DrawTopLineForBottom(PaintEventArgs e, CompatibilityHelper element, System.Drawing.Color color, int penWidth)
        {
            Pen pen   = new Pen(color, penWidth);
            var width = element.Width;

            e.Graphics.DrawLine(pen, new Point(0, 0), new Point(width, 0));
        }
Exemple #2
0
        private void DrawBottomLineForTop(PaintEventArgs e, CompatibilityHelper element, System.Drawing.Color color, int penWidth)
        {
            Pen pen    = new Pen(color, penWidth);
            var width  = element.Width;
            var height = element.Height;

            e.Graphics.DrawLine(pen, new Point(0, height - penWidth), new Point(width, height - penWidth));
        }
Exemple #3
0
        private void DrawBottomEllipse(PaintEventArgs e, CompatibilityHelper element, int penWidth)
        {
            Pen       pen    = new Pen(element.EllipseColor, penWidth);
            var       width  = element.Right;
            var       height = element.Height;
            Rectangle rect   = new Rectangle(0, height * -1, width - 2, (height * 2) - 2);

            e.Graphics.DrawEllipse(pen, rect);
        }
Exemple #4
0
        private Label CreateLabel(CompatibilityHelper element, int height, int width, int left, int top, string text, Font font, Color foreColor)
        {
            var label = new Label();

            label.Height    = height;
            label.Width     = width;
            label.Top       = top;
            label.Left      = left;
            label.Text      = text;
            label.Font      = font;
            label.ForeColor = foreColor;
            label.TextAlign = ContentAlignment.MiddleCenter;

            return(label);
        }
Exemple #5
0
        private bool ShowEveryDayAndSpiritualityCompatibility(Comparison comparison1, Comparison comparison2, int yearsRelationsStart, int period)
        {
            CleanCompatibilityBase();

            var daysInYear = new DateTime(yearsRelationsStart, 12, 31).Subtract(new DateTime(yearsRelationsStart, 1, 1)).Days + 1;

            if (comparison1.EveryDayStabilityNumber == 0 || comparison2.EveryDayStabilityNumber == 0 ||
                comparison1.SpiritualStabilityNumber == 0 || comparison2.SpiritualStabilityNumber == 0)
            {
                return(false);
            }

            decimal everyDay     = (comparison1.EveryDayStabilityNumber * comparison2.EveryDayStabilityNumber) / (decimal)daysInYear;
            decimal spirituality = (comparison1.SpiritualStabilityNumber * comparison2.SpiritualStabilityNumber) / (decimal)daysInYear;

            var everyDayRounded     = Round(everyDay);     //1
            var spiritualityRounded = Round(spirituality); //2

            int firstRowPanelTop   = 0;
            int panelRowHeight     = 50;
            int regularLabelHeight = 15;
            int spaceBetweenLabels = 2;
            int leftElementLeft    = 0;

            int secondRowPanelTop = firstRowPanelTop + panelRowHeight + (2 * regularLabelHeight) + (3 * spaceBetweenLabels);
            var biggestYear       = yearsRelationsStart + period;
            var baseWidth         = pnlCompatibilityBase.Width;
            int pxForOneYear      = baseWidth / period;

            var firstRowElementsCount  = (int)decimal.Ceiling(baseWidth / (everyDayRounded * pxForOneYear));
            var secondRowElementsCount = (int)decimal.Ceiling(baseWidth / (spiritualityRounded * pxForOneYear));

            List <CompatibilityHelper> firstRowElements  = new List <CompatibilityHelper>(firstRowElementsCount);
            List <CompatibilityHelper> secondRowElements = new List <CompatibilityHelper>(secondRowElementsCount);

            for (int i = 0; i < firstRowElementsCount; i++)
            {
                var element = new CompatibilityHelper();

                element.Top          = firstRowPanelTop;
                element.Height       = panelRowHeight;
                element.Bottom       = element.Top + element.Height;
                element.EllipseColor = System.Drawing.Color.Blue;

                if (i == 0)
                {
                    element.IsFirstElement = true;
                    element.StartYear      = yearsRelationsStart;
                    element.EndYear        = element.StartYear + everyDayRounded;
                    element.Left           = leftElementLeft;
                    element.Width          = (int)(everyDayRounded * pxForOneYear);
                    element.Right          = (int)(everyDayRounded * pxForOneYear);
                }
                else
                {
                    element.StartYear = firstRowElements[i - 1].EndYear;
                    element.EndYear   = element.StartYear + everyDayRounded;
                    element.Width     = ((int)(everyDayRounded * pxForOneYear)) - 1;
                    element.Left      = firstRowElements[i - 1].Left + firstRowElements[i - 1].Width + 1;
                    element.Right     = ((int)(everyDayRounded * pxForOneYear)) - 1;
                }

                if (i == (firstRowElementsCount - 1))
                {
                    element.IsLastElement = true;
                    element.Width         = baseWidth - element.Left;
                    element.Right         = ((int)(everyDayRounded * pxForOneYear)) - 1;
                }
                firstRowElements.Add(element);
            }

            for (int i = 0; i < secondRowElementsCount; i++)
            {
                var element = new CompatibilityHelper();

                element.Top          = secondRowPanelTop;
                element.Height       = panelRowHeight;
                element.Bottom       = element.Top + element.Height;
                element.EllipseColor = System.Drawing.Color.Green;

                if (i == 0)
                {
                    element.IsFirstElement = true;
                    element.StartYear      = yearsRelationsStart;
                    element.EndYear        = element.StartYear + spiritualityRounded;
                    element.Left           = leftElementLeft;
                    element.Width          = (int)(spiritualityRounded * pxForOneYear);
                    element.Right          = (int)(spiritualityRounded * pxForOneYear);
                }
                else
                {
                    element.StartYear = secondRowElements[i - 1].EndYear;
                    element.EndYear   = element.StartYear + spiritualityRounded;
                    element.Width     = ((int)(spiritualityRounded * pxForOneYear)) - 1;
                    element.Left      = secondRowElements[i - 1].Left + secondRowElements[i - 1].Width + 1;
                    element.Right     = ((int)(spiritualityRounded * pxForOneYear)) - 1;
                }

                if (i == (secondRowElementsCount - 1))
                {
                    element.IsLastElement = true;
                    element.Width         = baseWidth - element.Left;
                    element.Right         = ((int)(spiritualityRounded * pxForOneYear)) - 1;
                }
                secondRowElements.Add(element);
            }

            DrawCompatibilityObjects(firstRowElements, true);
            DrawCompatibilityObjects(secondRowElements, false);

            DrawCompatibilityLabels(firstRowElements, secondRowElements);
            return(true);
        }