コード例 #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();
            }
        }
コード例 #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 + cap;
            float H = Y + Height;



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

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

            StringFormat stringFormat = new StringFormat(StringFormatFlags.DirectionVertical);
            Font         font         = new Font("Arial", frame.FontSize, FontStyle.Regular);

            float offset      = 0;
            float middlePoint = 0;

            foreach (Mullion mullion in frame.HorizontalMullions())
            {
                offset      = mullion.Model.Offset;
                middlePoint = mullion.Model.MiddlePoint;
                if (offset != 0)
                {
                    graphics.DrawString(offset.ToString(), font, fontBrush, LabelPosition(middlePoint, offset), stringFormat);
                }
                // Draw the cap
                points[0].Y = points[1].Y = middlePoint + frame.Y;
                graphics.DrawLines(pen, points);
            }
            offset      = Height - middlePoint;
            middlePoint = Height;
            graphics.DrawString(offset.ToString(), font, fontBrush, LabelPosition(middlePoint, offset), stringFormat);
            points[0].Y = points[1].Y = H;
            graphics.DrawLines(pen, points);

            points[0].Y = points[1].Y = H;
            graphics.DrawLines(pen, points);

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