Пример #1
0
        public void drawLine(nLine line)
        {
            Pen pen = new Pen(line.lineColor, 1);
            gfx.DrawLine(pen, line.xBegin, line.yBegin, line.xEnd, line.yEnd);

            Point position = new Point((int)line.xBegin, (int)(line.yBegin - 10));
            if (line.sName == "Leading" || line.sName == "xHeight" || line.sName == "Base" || line.sName == "ascenderHeight" || line.sName == "MultiBase")
                position.X = (int)line.xEnd - (int)gfx.MeasureString(line.sName, fFont).Width;
            if (line.sName == "spaceEnd" || line.sName == "kerningEnd")
                position.Y = (int)line.yBegin + 10;
            gfx.DrawString(line.sName, fFont, new SolidBrush(line.lineColor), position);
        }
Пример #2
0
        public void linesBaseInit()
        {
            _base = new nLine();
            _base.sName = "Base";
            _base.lineColor = _SpecialLineColor;

            _multiBase = new nLine();
            _multiBase.sName = "MultiBase";
            _multiBase.lineColor = _SpecialLineColor;

            _Leading = new nLine();
            _Leading.sName = "Leading";

            _xHeight = new nLine();
            _xHeight.sName = "xHeight";

            _capHeight = new nLine();
            _capHeight.sName = "capHeight";

            _ascenderHeight = new nLine();
            _ascenderHeight.sName = "ascenderHeight";

            _descenderHeight = new nLine();
            _descenderHeight.sName = "descenderHeight";

            _SpaceBegin = new nLine();
            _SpaceBegin.sName = "spaceBegin";

            _SpaceEnd = new nLine();
            _SpaceEnd.sName = "spaceEnd";
            _SpaceEnd.lineColor = _SpecialLineColor;

            _KerningBegin = new nLine();
            _KerningBegin.sName = "kerningBegin";

            _KerningEnd = new nLine();
            _KerningEnd.sName = "kerningEnd";
            _KerningEnd.lineColor = _SpecialLineColor;
        }
Пример #3
0
        private void initDefaultLines()
        {
            _baseX = new nLine();
            _baseX.sName = "BaseX";
            _baseY = new nLine();
            _baseY.sName = "BaseY";
            _Leading = new nLine();
            _Leading.sName = "Leading";
            _xHeight = new nLine();
            _xHeight.sName = "xHeight";
            _capHeight = new nLine();
            _capHeight.sName = "capHeight";
            _ascenderHeight = new nLine();
            _ascenderHeight.sName = "ascenderHeight";
            _descenderHeight = new nLine();
            _descenderHeight.sName = "descenderHeight";
            _Width = new nLine();
            _Width.sName = "Width";

            _baseY.lineColor = Color.Red;
            _Width.lineColor = Color.Red;
            _baseX.lineColor = Color.Red;
        }
Пример #4
0
        private void drawLine(nLine line)
        {
            nPen.Color = line.lineColor;
            nBrush = new SolidBrush(line.lineColor);
            /*
             * Fallowing code handles the problem with text beeing on the same side;
             * with this around 50-50 text are on both sides;
             */
            int positionX = (int)line.xBegin;
            int positionY = (int)(line.yBegin - 10);
            if (line.sName == "Leading" || line.sName == "xHeight" || line.sName == "BaseX")
                positionX = (int)line.xEnd - (int)gfx.MeasureString(line.sName, ffont).Width;
            /*
             * checking just for baseY line;
             * since I want text to be draw above line I am using y-10,
             * BUT that makes baseY text to disapear from the screen;
             */
            if (line.sName == "BaseY" || line.sName == "Width")
                positionY += 10;
            else
                positionY = (int)(line.yBegin - 10);

            gfx.DrawLine(nPen, line.xBegin, line.yBegin, line.xEnd, line.yEnd);
            gfx.DrawString(line.sName, ffont, nBrush, positionX, positionY);
        }
Пример #5
0
        private void lineIntersects(nLine line, Point mouseLocation)
        {
            if (mouseLocation.X >= line.xBegin && mouseLocation.X <= line.xEnd &&
                mouseLocation.Y >= line.yBegin && mouseLocation.Y <= line.yEnd)
            {
                panelPreview.MouseUp += new MouseEventHandler(panelPreview_MouseUpTwo);
                panelPreview.MouseMove += new MouseEventHandler((o,s) =>
                {
                    line.init(0, s.Y, panelPreview.Width, s.Y);
                    UpdatePreviewWindow();
                });

                setAllLinesUnmovable();
                line.movable = true;
                line.lineColor = _SelectedLineColor;
                UpdatePreviewWindow();
            }
        }
Пример #6
0
        void panelPreview_MouseMove(object sender, MouseEventArgs e)
        {
            previewDefault = false;
            _base = new nLine(5, e.Y, panelPreview.Width - 5, e.Y);
            newPreviewX = e.X;

            UpdatePreviewWindow();
            panelPreview.Focus();
        }