Beispiel #1
0
        internal static void UpdateMullionsCode(PVCFrame frame, Orientation orienation)
        {
            frame.ValidateChildren();
            List <Mullion> items  = frame.HorizontalMullions();;
            string         prefix = ".MH";

            if (orienation == Orientation.Vertical)
            {
                items  = frame.VerticalMullions();
                prefix = ".MV";
            }

            for (int i = 0; i < items.Count; i++)
            {
                items[i].Model.Code = frame.Model.Code + prefix + (i + 1).ToString();
            }
        }
Beispiel #2
0
        protected override void Paint(PPaintContext paintContext)
        {
            Graphics graphics = paintContext.Graphics;

            graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            graphics.FillRectangle(Brushes.White, X, Y, Width, Height);

            float cap = 3;

            if (paintContext.Canvas != null && paintContext.Camera.ViewScale < 1)
            {
                cap = cap * (1 + (1 - paintContext.Camera.ViewScale) * 2);
            }

            float W = X + Width;
            float H = Y + cap;

            PointF[] points = new PointF[] { new PointF(X, H), new PointF(W, H) };
            graphics.DrawLines(pen, points);

            List <Mullion> mullions = frame.VerticalMullions();

            points[0].X  = points[1].X = X;
            points[0].Y -= cap;
            points[1].Y += cap;
            graphics.DrawLines(pen, points);

            Font font = new Font("Arial", frame.FontSize, FontStyle.Regular);

            float offset      = 0;
            float middlePoint = 0;



            foreach (Mullion mullion in mullions)
            {
                offset      = mullion.Model.Offset;
                middlePoint = mullion.Model.MiddlePoint;

                if (offset != 0)
                {
                    graphics.DrawString(offset.ToString(), font, fontBrush, LabelPosition(middlePoint, offset));
                }

                // Draw the cap
                points[0].X = points[1].X = middlePoint + frame.X;
                graphics.DrawLines(pen, points);
            }
            offset      = Width - middlePoint;
            middlePoint = Width;
            graphics.DrawString(offset.ToString(), font, fontBrush, LabelPosition(middlePoint, offset));
            points[0].X = points[1].X = W;
            graphics.DrawLines(pen, points);

            // Main axis
            H      = Y + DefaultHeight - OFFSET;
            points = new PointF[] {
                new PointF(X, H),
                new PointF(X, H + cap * 2),
                new PointF(X, H + cap),
                new PointF(W, H + cap),
                new PointF(W, H),
                new PointF(W, H + cap * 2)
            };
            graphics.DrawLines(pen, points);
            graphics.DrawString(Width.ToString(), font, fontBrush, Center);
        }