Exemplo n.º 1
0
        void PreviewPane_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            C1PrintDocument doc = ((C1PreviewPane)sender).Document as C1PrintDocument;

            if (doc == null)
            {
                return;
            }
            Point  pt = new Point(e.X, e.Y);
            int    pageIdx;
            PointF pDoc;

            if (!((C1PreviewPane)sender).ClientToDocument(pt, out pageIdx, out pDoc))
            {
                return;
            }
            if (!doc.Pages[pageIdx].HasFragments)
            {
                return;
            }

            RenderText rt = FindRenderText(doc.Pages[pageIdx].Fragments, pDoc,
                                           ((C1PreviewPane)sender).DpiX, ((C1PreviewPane)sender).DpiY);

            if (rt != null)
            {
                _textEditor.textBox1.Text = rt.Text;
                _textEditor.Location      = ((C1PreviewPane)sender).PointToScreen(pt);
                if (_textEditor.ShowDialog(this) == DialogResult.OK)
                {
                    rt.Text = _textEditor.textBox1.Text;
                    doc.Reflow();
                }
            }
        }